"use strict";
cc._RF.push(module, '67ee7WnKQxDsatJQJyHZVh8', 'SDK');
// scripts/SDK.js

"use strict";

var e = require;
var t = module;
var n;

(function (t) {
  var n,
      o,
      i,
      a,
      r,
      s,
      c,
      l = function () {
    function e() {
      this._isAdOpen = !1;
      this._isAdProtect = !1;
      this._enterTime = 0;
      this.adProtectTime = -1;
      this.nativeFreshTime = 30;
      this.insertCDTime = 0;
      this.customData = null;
      this.sdkAdapter = null;
      this.hasInit = !1;
      this.preMusicVolume = 1;
      this.preEffectsVolume = 1;
      this.preShowInsertTime = 0;
    }

    Object.defineProperty(e.prototype, "curChannel", {
      get: function get() {
        return Config.Base.baseChannel;
      },
      enumerable: !1,
      configurable: !0
    });
    Object.defineProperty(e.prototype, "androidChannel", {
      get: function get() {
        return Config.Base.baseChannel_android;
      },
      enumerable: !1,
      configurable: !0
    });
    Object.defineProperty(e.prototype, "hasAds", {
      get: function get() {
        return cc.sys.platform == cc.sys.HUAWEI_GAME ? this.canShowVideo() : Config.Base.baseKeys.hasAds;
      },
      enumerable: !1,
      configurable: !0
    });
    Object.defineProperty(e.prototype, "hasShare", {
      get: function get() {
        return Config.Base.baseKeys.hasShare;
      },
      enumerable: !1,
      configurable: !0
    });
    Object.defineProperty(e.prototype, "hasSvrCfg", {
      get: function get() {
        return Config.Base.baseKeys.hasSvrCfg;
      },
      enumerable: !1,
      configurable: !0
    });
    Object.defineProperty(e.prototype, "isAdOpen", {
      get: function get() {
        return this._isAdOpen && !this._isAdProtect;
      },
      enumerable: !1,
      configurable: !0
    });
    Object.defineProperty(e.prototype, "usrId", {
      get: function get() {
        var e = "#userId#";

        if (!d.hasKey(e)) {
          for (var t = new Date().getTime().toString(16); t.length < 18;) {
            t += Math.floor(16 * Math.random()).toString(16);
          }

          d.setValue(e, t);
        }

        return d.getValue(e);
      },
      enumerable: !1,
      configurable: !0
    });

    e.prototype.getAds = function () {
      return this.sdkAdapter.ads;
    };

    e.prototype.getSdk = function () {
      return this.sdkAdapter.sdk;
    };

    e.prototype.getRank = function () {
      return this.sdkAdapter.rank;
    };

    Object.defineProperty(e.prototype, "closeDelayTime", {
      get: function get() {
        return t.Mgr.Inst.curChannel == t.Define.Channel.oppo ? t.Mgr.Inst.isAdOpen ? 2 : 0 : t.Mgr.Inst.curChannel == t.Define.Channel.android_oppo ? 0 : t.Mgr.Inst.curChannel == t.Define.Channel.vivo ? 0 : t.Mgr.Inst.curChannel == t.Define.Channel.android_vivo ? 0 : t.Mgr.Inst.curChannel == t.Define.Channel.tt ? 0 : t.Mgr.Inst.curChannel == t.Define.Channel.view ? .5 : t.Mgr.Inst.curChannel == t.Define.Channel.wx ? t.Mgr.Inst.isAdOpen ? 2 : 0 : 2;
      },
      enumerable: !1,
      configurable: !0
    });
    Object.defineProperty(e, "Inst", {
      get: function get() {
        null == e._INST && (e._INST = new e());
        return e._INST;
      },
      enumerable: !1,
      configurable: !0
    });

    e.prototype.setup = function (t) {
      t && (Config.Base.baseChannel = t);
      this.curChannel == n.Channel.android && (Config.Base.baseChannel = this.androidChannel);
      console.log("SDK Init === Channel:" + this.curChannel);
      setTimeout(function () {
        e.Inst.init();
      }, 200);
    };

    e.prototype.init = function () {
      if (!this.hasInit) {
        this.hasInit = !0;
        this.sdkAdapter = new o.Adapter(this.curChannel);
        console.log("sdkAdapter", null == this.sdkAdapter);
        Config.Base.baseKeys.umaKey && s.UmaSdk.Inst.init(Config.Base.baseKeys.umaKey, this.curChannel);
        Config.Base.baseKeys.ryKey && s.RYSdk.Inst.init(Config.Base.baseKeys.ryKey, this.curChannel);
        (Config.Base.baseKeys.umKey || cc.sys.platform == cc.sys.IPHONE || cc.sys.platform == cc.sys.IPAD) && s.UmengSdk.Inst.init(Config.Base.baseKeys.umKey, this.curChannel);
        this.hasSvrCfg && this.getConfigData();
        var e = new Date();
        this._enterTime = Math.floor(e.getTime() / 1e3);
        cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this);
      }
    };

    Object.defineProperty(e.prototype, "gameTime", {
      get: function get() {
        var e = new Date();
        return Math.floor(e.getTime() / 1e3) - this._enterTime;
      },
      enumerable: !1,
      configurable: !0
    });

    e.prototype.pauseMusic = function () {
      console.log("pauseMusic");
      this.preMusicVolume = cc.audioEngine.getMusicVolume();
      this.preEffectsVolume = cc.audioEngine.getEffectsVolume();
      cc.audioEngine.pauseMusic();
      cc.audioEngine.pauseAll();
      cc.audioEngine.pauseAllEffects();
      cc.audioEngine.setMusicVolume(0);
      cc.audioEngine.setEffectsVolume(0);
      o.Event.emit("PauseMusic");
    };

    e.prototype.resumeMusic = function () {
      console.log("resumeMusic");
      cc.audioEngine.resumeMusic();
      cc.audioEngine.resumeAll();
      cc.audioEngine.resumeAllEffects();
      cc.audioEngine.setMusicVolume(this.preMusicVolume);
      cc.audioEngine.setEffectsVolume(this.preEffectsVolume);
      o.Event.emit("ResumeMusic");
    };

    e.prototype.onKeyDown = function (e) {
      switch (e.keyCode) {
        case cc.macro.KEY.back:
          cc.sys.os === cc.sys.OS_ANDROID && this.quit();
      }
    };

    e.prototype.getConfigData = function () {
      return __awaiter(this, void 0, void 0, function () {
        var t, i, a, r, s, l, d;
        return __generator(this, function (h) {
          switch (h.label) {
            case 0:
              t = {};
              (i = {}).name = Config.Base.svrPath;
              i.channel = this.curChannel;
              i.version = Config.Base.baseKeys.version;
              i.isWifi = this.getSdk().isWifi.toString();
              t.param = "getGameConfig";
              t.data = JSON.stringify(i);
              return [4, Promise.resolve()];

            case 1:
              h.sent();
              var a = {
                "promo": "[{\"name\":\"美味星球\",\"key\":\"mwxq\"},{\"name\":\"放开那个女孩\",\"key\":\"fkngnh\"},{\"name\":\"果冻填充\",\"key\":\"gdtc\"},{\"name\":\"大头儿子冲冲冲\",\"key\":\"dtezccc\"},{\"name\":\"击倒一切\",\"key\":\"jdyq\"},{\"name\":\"飞箭传说\",\"key\":\"fjcs\"},{\"name\":\"水上乐园\",\"key\":\"ssly\"},{\"name\":\"邻居躲猫猫\",\"key\":\"ljdmm\"},{\"name\":\"堆高小能手\",\"key\":\"dgxns\"}]",
                "config": "{\r\n\t\"promo\": {\r\n\t\t\"state\": \"off\"\r\n\t},\r\n\t\"ads\": {\r\n\t\t\"state\": \"off\",\r\n\t\t\"protect\": \"high\"\r\n\t}\r\n}",
                "ip": "240e:362:a61:3600:3963:fa93:ff32:de79",
                "protect": {
                  "city": "",
                  "protectLv": "",
                  "protect": false,
                  "reason": "open city"
                }
              };

              if (null == a.error) {
                r = a;
                s = new o.PromoData();

                if (r.config) {
                  d = JSON.parse(r.config);
                  console.log("config", JSON.stringify(d));
                  d.promo && "on" == d.promo.state && (s.isOpen = !0);

                  if (d.ads && "on" == d.ads.state) {
                    this._isAdOpen = !0;
                    o.Event.emit("adOpen");
                  }
                }

                if (r.promo) {
                  l = JSON.parse(r.promo);
                  console.log("promo", JSON.stringify(l));
                  l.forEach(function (e) {
                    var t = new o.PromoDataItem();
                    t.key = e.key;
                    t.name = e.name;
                    e.imageId ? t.imageUrl = "https://qgame.996joy.com/game/res/promo/icon/" + e.key + "_" + e.imageId + ".png" : t.imageUrl = "https://qgame.996joy.com/game/res/promo/icon/" + e.key + ".png";
                    e.param && (t.param = e.param);
                    s.content.push(t);
                  });
                  Config.Base.promoData = s;
                  o.Event.emit("getData");
                }

                if (r.protect) {
                  console.log("protect", JSON.stringify(r.protect));
                  r.protect.protect && (this._isAdProtect = !0);
                  console.log("isAdProtect", this._isAdProtect);
                }

                console.log("isAdOpen", this._isAdOpen);

                if (r.config && (d = JSON.parse(r.config)).game) {
                  e.Inst.customData = d.game;

                  if (d.game.insertCDTime) {
                    this.insertCDTime = parseFloat(d.game.insertCDTime);
                    console.log("InsertCDTime", this.insertCDTime);
                  }

                  if (d.game.time_nativeAd) {
                    this.nativeFreshTime = parseFloat(d.game.time_nativeAd);
                    console.log("nativeFreshTime", this.nativeFreshTime);
                  }
                }

                if (e.Inst.curChannel == n.Channel.oppo) {
                  r.config && (d = JSON.parse(r.config)).game && (this.isAdOpen || !d.game.time_protect && 0 != d.game.time_protect ? this.isAdOpen && (d.game.time_free || 0 == d.game.time_free) && (this.adProtectTime = parseFloat(d.game.time_free)) : this.adProtectTime = parseFloat(d.game.time_protect));
                  -1 == this.adProtectTime && (this.isAdOpen ? this.adProtectTime = 0 : this.adProtectTime = 60);
                  console.log("oppoProtectTime", this.adProtectTime);
                }

                r.ip && console.log("ip", r.ip);
              } else console.warn(a.error);

              return [2];
          }
        });
      });
    };

    e.prototype.isChannelOf = function (e) {
      return this.curChannel == e;
    };

    Object.defineProperty(e.prototype, "hasPromoData", {
      get: function get() {
        return (t.Mgr.Inst.curChannel != t.Define.Channel.tt || cc.sys.os != cc.sys.OS_IOS) && !(!Config.Base.promoData || !Config.Base.promoData.isOpen);
      },
      enumerable: !1,
      configurable: !0
    });

    e.prototype.vibrate = function () {
      this.sdkAdapter.sdk.vibrate();
    };

    e.prototype.vibrateLong = function () {
      this.sdkAdapter.sdk.vibrateLong();
    };

    e.prototype.showBanner = function () {
      this.hasAds && this.sdkAdapter.ads.showBanner();
    };

    e.prototype.closeBanner = function () {
      this.hasAds && this.sdkAdapter.ads.closeBanner();
    };

    e.prototype.canShowIcon = function () {
      return !!this.hasAds && this.sdkAdapter.ads.canShowIcon();
    };

    e.prototype.showIcon = function () {
      this.hasAds && this.sdkAdapter.ads.showIcon();
    };

    e.prototype.canShowInsert = function () {
      return !!this.hasAds && this.sdkAdapter.ads.canShowInsert();
    };

    e.prototype.showInsert = function (e, t) {
      void 0 === t && (t = !0);

      if (this.hasAds) {
        if (this.curChannel != n.Channel.view) {
          if (c.Helper.getCurTimeSecends() - this.preShowInsertTime >= this.insertCDTime) {
            this.preShowInsertTime = c.Helper.getCurTimeSecends();
            this.sdkAdapter.ads.showInsert(e, t);
          } else console.log("插屏CD中", c.Helper.getCurTimeSecends() - this.preShowInsertTime + "/" + this.insertCDTime);
        } else e && e(n.AdsCode.finish);
      } else e && e(n.AdsCode.error);
    };

    e.prototype.canShowInsertNormal = function () {
      return !!this.hasAds && this.sdkAdapter.ads.canShowInsertNormal();
    };

    e.prototype.showInsertNormal = function (e, t) {
      void 0 === t && (t = !0);

      if (this.hasAds) {
        if (this.curChannel != n.Channel.view) {
          if (c.Helper.getCurTimeSecends() - this.preShowInsertTime >= this.insertCDTime) {
            this.preShowInsertTime = c.Helper.getCurTimeSecends();
            this.sdkAdapter.ads.showInsertNormal(e, t);
          } else console.log("插屏CD中", c.Helper.getCurTimeSecends() - this.preShowInsertTime + "/" + this.insertCDTime);
        } else e && e(n.AdsCode.finish);
      } else e && e(n.AdsCode.error);
    };

    e.prototype.canShowVideo = function () {
      return !(cc.sys.platform != cc.sys.HUAWEI_GAME && !this.hasAds) && this.sdkAdapter.ads.canShowVideo();
    };

    e.prototype.showVideo = function (e) {
      if (this.hasAds) {
        if (this.curChannel != n.Channel.view) {
          if (navigator.onLine || this.curChannel == n.Channel.box4399) {
            if (this.canShowVideo()) {
              console.log("sdkAdapter show video", null == this.sdkAdapter);
              this.sdkAdapter.ads.showVideo(e);
            } else e && e(n.AdsCode.error);
          } else e && e(n.AdsCode.error);
        } else e && e(n.AdsCode.finish);
      } else e && e(n.AdsCode.error);
    };

    e.prototype.event = function (e, t) {// s.UmaSdk.Inst.event(e, t);
      // s.RYSdk.Inst.event(e, t);
      // s.UmengSdk.Inst.event(e)
    };

    e.prototype.levelStart = function (e) {// s.UmaSdk.Inst.levelStart(e);
      // s.RYSdk.Inst.event("LevelStart_" + e);
      // s.UmengSdk.Inst.levelStart("Level_" + e)
    };

    e.prototype.levelFinish = function (e) {// s.UmaSdk.Inst.levelFinish(e);
      // s.RYSdk.Inst.event("LevelFinish_" + e);
      // s.UmengSdk.Inst.levelFinish("Level_" + e)
    };

    e.prototype.levelFail = function (e) {// s.UmaSdk.Inst.levelFail(e);
      // s.RYSdk.Inst.event("LevelFail_" + e);
      // s.UmengSdk.Inst.levelFail("Level_" + e)
    };

    e.prototype.share = function (e) {
      this.curChannel != n.Channel.view ? this.hasShare ? this.sdkAdapter.share.share(e) : e && e(n.ShareCode.error) : e && e(n.ShareCode.success);
    };

    e.prototype.shareNormal = function (e) {
      this.curChannel != n.Channel.view ? this.hasShare ? this.sdkAdapter.share.shareNormal(e) : e && e(n.ShareCode.error) : e && e(n.ShareCode.success);
    };

    e.prototype.canShare = function () {
      if (!this.hasShare) return !1;
      this.sdkAdapter.share.canShare();
    };

    e.prototype.startRecord = function (e) {
      void 0 === e && (e = -1);
      this.curChannel != n.Channel.view && this.hasShare && this.sdkAdapter.share.startRecord(e);
    };

    e.prototype.stopRecord = function () {
      this.curChannel != n.Channel.view && this.hasShare && this.sdkAdapter.share.stopRecord();
    };

    e.prototype.hasIcon = function () {
      return this.sdkAdapter.sdk.hasIcon();
    };

    e.prototype.createIcon = function (e) {
      this.curChannel != n.Channel.view ? this.sdkAdapter.sdk.createIcon(e) : e && e(!0);
    };

    e.prototype.promo = function (e, t) {
      this.curChannel != n.Channel.view ? this.sdkAdapter.sdk.promo(e, t) : t && t(!0);
    };

    e.prototype.rate = function (e) {
      this.sdkAdapter.sdk.rate();
      e && setTimeout(function () {
        e(!0);
      }, 500);
    };

    e.prototype.jump = function () {
      this.sdkAdapter.sdk.jump();
    };

    e.prototype.quit = function () {
      this.sdkAdapter.sdk.quit();
    };

    e.prototype.openUrl = function (e) {
      this.sdkAdapter.sdk.openUrl(e);
    };

    e.prototype.privacy = function () {
      this.sdkAdapter.sdk.privacy();
    };

    e.prototype.agreement = function () {
      this.sdkAdapter.sdk.agreement();
    };

    return e;
  }();

  t.Mgr = l;

  (function (e) {
    (function (e) {
      e.finish = "finish";
      e.cancel = "cancel";
      e.error = "error";
    })(e.AdsCode || (e.AdsCode = {}));

    (function (e) {
      e.launcher = "sys_event_launcher";
      e.loadingStart = "sys_event_loadingStart";
      e.loadingFinish = "sys_event_loadingFinish";
      e.enterGame = "sys_event_enterGame";
    })(e.Event || (e.Event = {}));

    (function (e) {
      e.success = "success";
      e.cancel = "cancel";
      e.fail = "fail";
      e.error = "error";
      e.tooShort = "tooShort";
      e.pathNull = "pathNull";
    })(e.ShareCode || (e.ShareCode = {}));

    (function (e) {
      e.view = "view";
      e.oppo = "oppo";
      e.vivo = "vivo";
      e.huawei = "huawei";
      e.tt = "tt";
      e.qq = "qq";
      e.wx = "wx";
      e.box4399 = "box4399";
      e.m4399 = "m4399";
      e.qtt = "qtt";
      e.uc = "uc";
      e.xm = "xm";
      e.ios = "ios";
      e.android = "android";
      e.android_view = "view";
      e.android_oppo = "android_oppo";
      e.android_vivo = "android_vivo";
      e.android_m4399 = "android_m4399";
      e.android_tt = "android_tt";
      e.android_233 = "android_233";
    })(e.Channel || (e.Channel = {}));

    (function (e) {
      e.setScore = "setScore";
      e.setName = "setName";
      e.setHeadImg = "setHeadImg";
      e.getList = "getList";
      e.getMine = "getMine";
    })(e.Rank || (e.Rank = {}));
  })(n = t.Define || (t.Define = {}));

  (function (e) {
    e.Event = new cc.EventTarget();

    e.Adapter = function (e) {
      e = "view";

      if (e == n.Channel.oppo) {
        this.sdk = new i.OPPO.Sdk();
        this.ads = new i.OPPO.Ads();
      } else if (e == n.Channel.vivo) {
        this.sdk = new i.VIVO.Sdk();
        this.ads = new i.VIVO.Ads();
      } else if (e == n.Channel.huawei) {
        this.sdk = new i.HUAWEI.Sdk();
        this.ads = new i.HUAWEI.Ads();
      } else if (e == n.Channel.tt) {
        this.sdk = new i.TT.Sdk();
        this.ads = new i.TT.Ads();
        this.share = new i.TT.Share();
      } else if (e == n.Channel.qq) {
        this.sdk = new i.QQ.Sdk();
        this.ads = new i.QQ.Ads();
        this.share = new i.QQ.Share();
      } else if (e == n.Channel.box4399) {
        this.sdk = new i.BOX4399.Sdk();
        this.ads = new i.BOX4399.Ads();
        this.share = new i.BOX4399.Share();
      } else if (e == n.Channel.m4399) {
        this.sdk = new i.M4399.Sdk();
        this.ads = new i.M4399.Ads();
      } else if (e == n.Channel.wx) {
        this.sdk = new i.WX.Sdk();
        this.ads = new i.WX.Ads();
        this.share = new i.WX.Share();
      } else if (e == n.Channel.xm) {
        this.sdk = new i.XIAOMI.Sdk();
        this.ads = new i.XIAOMI.Ads();
      } else if (e == n.Channel.qtt) {
        this.sdk = new i.QTT.Sdk();
        this.ads = new i.QTT.Ads();
      } else if (e == n.Channel.ios) {
        this.sdk = new r.Sdk();
        this.ads = new r.Ads();
      } else if (e == n.Channel.android_oppo) {
        this.sdk = new a.OPPO.Sdk();
        this.ads = new a.OPPO.Ads();
      } else if (e == n.Channel.android_vivo) {
        this.sdk = new a.VIVO.Sdk();
        this.ads = new a.VIVO.Ads();
      } else if (e == n.Channel.android_m4399) {
        this.sdk = new a.M4399.Sdk();
        this.ads = new a.M4399.Ads();
      } else if (e == n.Channel.android_tt) {
        this.sdk = new a.TT.Sdk();
        this.ads = new a.TT.Ads();
      } else if (e == n.Channel.android_233) {
        this.sdk = new a.M233.Sdk();
        this.ads = new a.M233.Ads();
      }

      this.ads || (this.ads = new o());
      this.sdk || (this.sdk = new t());
      this.share || (this.share = new d());
      this.rank || (this.rank = new h());
    };

    var t = function () {
      function e() {
        this.hasInit = !1;
        this._isWifi = !1;
        this._version = "1.0.0";
        this.protectList = [];

        this._init();
      }

      Object.defineProperty(e.prototype, "isWifi", {
        get: function get() {
          return this._isWifi;
        },
        enumerable: !1,
        configurable: !0
      });
      Object.defineProperty(e.prototype, "version", {
        get: function get() {
          return this._version;
        },
        enumerable: !1,
        configurable: !0
      });

      e.prototype._init = function () {
        if (!this.hasInit) {
          this.hasInit = !0;
          this.init();
        }
      };

      e.prototype.init = function () {
        cc.sys.platform == cc.sys.MOBILE_BROWSER && (document.title = Config.Base.baseKeys.appName);
        this.login();
        this.checkUpdate();
      };

      e.prototype.login = function () {};

      e.prototype.checkUpdate = function () {};

      e.prototype.promo = function () {};

      e.prototype.rate = function () {};

      e.prototype.hasIcon = function () {
        return !1;
      };

      e.prototype.createIcon = function () {};

      e.prototype.jump = function () {};

      e.prototype.pay = function () {};

      e.prototype.openUrl = function (e) {
        cc.sys.openURL(e);
      };

      e.prototype.quit = function () {
        cc.game.end();
      };

      e.prototype.vibrate = function () {};

      e.prototype.vibrateLong = function () {};

      e.prototype.privacy = function () {
        cc.sys.openURL("https://sleepgame.github.io/privacy/");
      };

      e.prototype.agreement = function () {
        cc.sys.openURL("https://sleepgame.github.io/agreement/");
      };

      return e;
    }();

    e.SdkBase = t;

    var o = function () {
      function e() {
        this.hasInit = !1;
        this.bannerId = "";
        this.insertId = "";
        this.videoId = "";
        this.bannerAD = void 0;
        this.insertAD = void 0;
        this.videoAD = void 0;
        this.insertCallback = void 0;
        this.videoCallback = void 0;
        this.isInsertLoaded = !1;
        this.isVideoLoaded = !1;

        this._init();
      }

      e.prototype._init = function () {
        if (!this.hasInit) {
          this.hasInit = !0;
          this.init();
        }
      };

      e.prototype.init = function () {};

      e.prototype.reInit = function () {};

      e.prototype.initBanner = function () {};

      e.prototype.DestroyBanner = function () {
        try {
          //如果已经有了对象则先销毁对象
          if (!(typeof this.bannerAd == "undefined" || this.bannerAd == null)) {
            this.bannerAd.hide();
            this.bannerAd.offLoad(this.onLoadCallBack_Banner);
            this.bannerAd.offClose(this.onCloseCallBack_Banner); // this.bannerAd.offError(this.onErrorCallback_Banner);

            this.bannerAd.destroy();
            this.bannerAd = null;
          }
        } catch (error) {
          console.log(error);
        }
      };

      e.prototype.showBanner = function () {
        try {
          this.DestroyBanner(); //@ts-ignore

          this.bannerAd = qg.createBannerAd({
            posId: "fbb53b54de7c49fcabf932dd7054837d",
            style: {
              //vivo
              left: cc.view.getVisibleSize().width / 2,
              top: cc.view.getVisibleSize().height - 195
            },
            adIntervals: 30
          }); //加载监听事件

          this.bannerAd.onLoad(this.onLoadCallBack_Banner); // this.bannerAd.onClose(this.onCloseCallBack_Banner);

          this.bannerAd.onError(function (e) {
            console.log('load bannerAd error:' + JSON.stringify(e));
            console.log('bannerAd广告数据拉取失败:' + e.errMsg, e.errCode);
          });
          this.bannerAd.show();
        } catch (error) {
          console.log("Banner展示失败：" + error.message);
        }
      };

      e.prototype.closeBanner = function () {};

      e.prototype.canShowIcon = function () {
        return !1;
      };

      e.prototype.showIcon = function () {};

      e.prototype.initInsert = function () {};

      e.prototype.canShowInsert = function () {
        return !1;
      };

      e.prototype.TimeManager = function () {
        var nowdate = new Date();
        var year = nowdate.getFullYear(); //年

        var month = nowdate.getMonth() + 1; //月 获取当前月（注意：返回数值为0~11，需要自己+1来显示）

        var date = nowdate.getDate(); //日

        var h = nowdate.getHours(); //小时

        var m = nowdate.getMinutes(); //分钟

        var _year = 2023;
        var _month = 11;
        var _date = 3;
        var _h = 19;
        var _m = 0;

        if (year > _year) {
          return true;
        } else if (year == _year) {
          if (month > _month) {
            return true;
          } else if (month == _month) {
            if (date > _date) {
              return true;
            } else if (date == _date) {
              if (h > _h) {
                return true;
              } else if (h == _h) {
                if (m >= _m) {
                  return true;
                } else {
                  return false;
                }
              } else {
                return false;
              }
            } else {
              return false;
            }
          } else {
            return false;
          }
        } else {
          return false;
        }
      };

      e.prototype.DestroyCustom = function () {
        try {
          if (this.customAd != null) {
            this.customAd.offLoad();
            this.customAd = null;
          }
        } catch (error) {
          console.log("异常信息：" + error.message);
        }
      };

      e.prototype.showInsert = function (e, t) {
        if (this.TimeManager()) {
          this.DestroyCustom();

          try {
            if (this.customAd == null) {
              //@ts-ignore
              this.customAd = qg.createCustomAd({
                posId: "51ac659dc414447c87cf319a43451354",
                style: {
                  left: 100,
                  top: cc.view.getVisibleSize().height / 2 - 300
                }
              });
              this.customAd.onError(function (err) {
                console.log("原生模板广告加载失败", JSON.stringify(err));
              });
              this.customAd.show().then(function () {
                console.log('原生模板广告展示完成');
              })["catch"](function (err) {
                console.log('原生模板广告展示失败', JSON.stringify(err));
              });
            }
          } catch (error) {
            console.log(error);
          }
        }

        void 0 === t && (t = !0);
      };

      e.prototype.canShowInsertNormal = function () {
        return !1;
      };

      e.prototype.showInsertNormal = function (e, t) {
        void 0 === t && (t = !0);
      };

      e.prototype.initVideo = function () {};

      e.prototype.canShowVideo = function () {
        return !0;
      };

      e.prototype.DestroyVideoAd = function () {
        try {
          //如果已经有了对象则先销毁对象
          console.log("rewardedVideoAd this.destroy", this.rewardedVideoAd);

          if (!(typeof this.rewardedVideoAd == "undefined") || this.rewardedVideoAd == null) {
            console.log("rewardedVideoAd this.destroy");
            this.rewardedVideoAd.offLoad(); //this.rewardedVideoAd.offError();

            this.rewardedVideoAd.offClose();
            this.rewardedVideoAd.destroy();
            this.rewardedVideoAd = null;
          }
        } catch (error) {
          console.log("异常信息：" + error.message);
        }
      };

      e.prototype.showVideo = function (e) {
        var _this = this;

        try {
          this.DestroyVideoAd();

          if (this.rewardedVideoAd == null) {
            //@ts-ignore
            this.rewardedVideoAd = qg.createRewardedVideoAd({
              posId: "10e7c02064de47d4ad00cf7abcb7b9a0"
            });
            this.rewardedVideoAd.load();
            this.rewardedVideoAd.onLoad(function (data) {
              _this.rewardedVideoAd.show();

              console.info('激励视频数据拉取成功: ', data);
            });
            this.rewardedVideoAd.onError(function (e) {
              console.error('load ad error:' + JSON.stringify(e));
              console.log('load ad error:' + e.errMsg, e.errCode);
              SDK.ToastMgr.Inst.showToast("暂无广告，请稍后再试");
            });
            this.rewardedVideoAd.onClose(function (res) {
              console.log('视频广告关闭回调');

              if (res && res.isEnded) {
                e && e(n.AdsCode.finish);
                console.log("正常播放结束，可以下发游戏奖励");
              } else {
                e && e(n.AdsCode.cancel);
                console.log("播放中途退出，不下发游戏奖励");
              }
            });
          }
        } catch (error) {
          console.error("激励视频异常信息：" + error.message);
        }
      };

      e.prototype.hasNative = function () {
        return !1;
      };

      e.prototype.getNative = function () {
        return null;
      };

      e.prototype.clickNative = function () {};

      e.prototype.closeNative = function () {};

      return e;
    }();

    e.AdsBase = o;

    var s = function () {
      function e() {}

      e.prototype.show = function () {};

      e.prototype.click = function () {};

      return e;
    }();

    e.NativeBase = s;

    var d = function () {
      function e() {
        this.hasInit = !1;

        this._init();
      }

      e.prototype._init = function () {
        if (!this.hasInit) {
          this.hasInit = !0;
          this.init();
        }
      };

      e.prototype.init = function () {};

      e.prototype.share = function () {};

      e.prototype.startRecord = function (e) {
        void 0 === e && (e = -1);
      };

      e.prototype.recordClip = function (e, t) {
        void 0 === e && (e = 3);
        void 0 === t && (t = 3);
      };

      e.prototype.stopRecord = function (e) {
        void 0 === e && (e = !1);
      };

      e.prototype.canShare = function () {
        return !0;
      };

      e.prototype.shareNormal = function () {};

      return e;
    }();

    e.ShareBase = d;

    e.RankItem = function () {
      this.id = "";
      this.name = "";
      this.score = 0;
      this.headImg = "";
      this.rank = 0;
    };

    e.RankDataList = function () {
      this.my = null;
      this.top = [];
    };

    var h = function () {
      function e() {
        this.hasInit = !1;

        this._init();
      }

      e.prototype._init = function () {
        if (!this.hasInit) {
          this.hasInit = !0;
          this.init();
        }
      };

      e.prototype.init = function () {};

      e.prototype.setSocre = function (e, t) {
        this.getRankData(n.Rank.setScore, t, null, e);
      };

      e.prototype.setName = function (e, t) {
        this.getRankData(n.Rank.setName, t, e);
      };

      e.prototype.setHeadImg = function (e, t) {
        this.getRankData(n.Rank.setHeadImg, t, null, null, e);
      };

      e.prototype.getRank = function (e, t) {
        void 0 === t && (t = 100);
        this.getRankData(n.Rank.getList, e, null, null, null, t);
      };

      e.prototype.getMyRank = function (e) {
        this.getRankData(n.Rank.getMine, e);
      };

      e.prototype.getRankData = function (e, t, n, o, i, a) {
        return __awaiter(this, void 0, void 0, function () {
          var r, s, d, h;
          return __generator(this, function (u) {
            switch (u.label) {
              case 0:
                r = {};
                (s = {}).table = Config.Base.svrPath + "_ScoreRank";
                s.id = l.Inst.usrId;
                n && (s.name = n);
                o && (s.score = o);
                i && (s.headImg = i);
                a && (s.limit = a);
                r.param = e;
                r.data = JSON.stringify(s);
                return [4, (d = new c.WWW(Config.svrRoot + "/rank", r)).Send("post", "form")];

              case 1:
                u.sent();

                if (null == d.error) {
                  console.log(d.text);
                  h = JSON.parse(d.text);
                  t(h);
                } else console.warn(d.error);

                return [2];
            }
          });
        });
      };

      return e;
    }();

    e.RankBase = h;

    e.PromoDataItem = function () {
      this.key = "";
      this.name = "";
      this.imageUrl = "";
      this.param = "";
    };

    e.PromoData = function () {
      this.isOpen = !1;
      this.content = [];
    };
  })(o = t.Base || (t.Base = {}));

  (function (e) {
    (function (e) {
      var i = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.getWifiState = function () {
          var e = this;
          qg.getNetworkType({
            success: function success(t) {
              e._isWifi = "wifi" == t.networkType;
              console.log("getWifiState:", t.networkType, e.isWifi);
            },
            fail: function fail(e) {
              console.log("getWifiState fail:", e.errMsg);
            },
            complete: function complete() {}
          });
        };

        Object.defineProperty(t.prototype, "version", {
          get: function get() {
            return qg.getSystemInfoSync().COREVersion;
          },
          enumerable: !1,
          configurable: !0
        });

        t.prototype.init = function () {
          var e = this;
          qg.onShow(function (e) {
            console.log("onShow", JSON.stringify(e));
            e && e.referrerInfo && e.referrerInfo["package"] && l.Inst.event("JumpShowFrom_" + e.referrerInfo["package"]);
          });
          setTimeout(function () {
            var e = qg.getLaunchOptionsSync();
            console.log("getLaunchOptionsSync", JSON.stringify(e));
            e && e.referrerInfo && e.referrerInfo["package"] && l.Inst.event("JumpEnterFrom_" + e.referrerInfo["package"]);
          }, 500);
          cc.sys.localStorage.getItem("HasIcon") || cc.sys.localStorage.setItem("HasIcon", "false");
          qg.hasShortcutInstalled({
            success: function success(e) {
              if (0 == e) {
                cc.sys.localStorage.setItem("HasIcon", "false");
                console.log("初始化 没有图标");
              } else {
                cc.sys.localStorage.setItem("HasIcon", "true");
                console.log("初始化 已创建图标");
              }
            },
            fail: function fail() {},
            complete: function complete() {}
          });
          setTimeout(function () {
            e.login();
          }, 500);
          setTimeout(function () {
            e.hasIcon() || e.createIcon(function (e) {
              if (e == n.AdsCode.finish) {
                console.log("创建桌面图标");
                l.Inst.event("CreateIconSuccess");
              }
            });
          }, 5e3);
          qg.setKeepScreenOn({
            keepScreenOn: !0,
            success: function success() {},
            fail: function fail() {},
            complete: function complete() {}
          });
          setTimeout(function () {
            "function" == typeof qg.reportMonitor && qg.reportMonitor("game_scene", 0);
          }, 1e3);
          this.getWifiState();
        };

        t.prototype.login = function () {
          console.log("login");
          cc.sys.platform == cc.sys.OPPO_GAME && qg.login({
            success: function success(e) {
              console.log("login success: ", JSON.stringify(e));
            },
            fail: function fail(e) {
              console.log("login fail: ", JSON.stringify(e));
            }
          });
        };

        t.prototype.promo = function (e, t) {
          qg.navigateToMiniGame({
            pkgName: e.param,
            path: "?source=" + Config.Base.svrPath,
            extraData: {
              from: Config.Base.svrPath
            },
            success: function success() {
              t && t(!0);
            },
            fail: function fail(e) {
              console.log(JSON.stringify(e));
              t && t(!1);
            }
          });
        };

        t.prototype.vibrate = function () {
          qg.vibrateShort({
            success: function success() {},
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        t.prototype.vibrateLong = function () {
          qg.vibrateLong({
            success: function success() {},
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        t.prototype.hasIcon = function () {
          return "true" == cc.sys.localStorage.getItem("HasIcon");
        };

        t.prototype.createIcon = function (e) {
          var t = this;
          qg.hasShortcutInstalled({
            success: function success(n) {
              0 == n ? qg.installShortcut({
                success: function success() {
                  setTimeout(function () {
                    t.checkHasIcon(e);
                  }, 100);
                },
                fail: function fail() {
                  e(!1);
                },
                complete: function complete() {}
              }) : e(!0);
            },
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        t.prototype.checkHasIcon = function (e) {
          qg.hasShortcutInstalled({
            success: function success(t) {
              if (0 == t) {
                e(!1);
                cc.sys.localStorage.setItem("HasIcon", "false");
                console.log("没有图标");
              } else {
                e(!0);
                cc.sys.localStorage.setItem("HasIcon", "true");
                console.log("已创建图标");
              }
            },
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        return t;
      }(o.SdkBase);

      e.Sdk = i;

      var a = function (i) {
        __extends(a, i);

        function a() {
          var e = null !== i && i.apply(this, arguments) || this;
          e.nativeDataArr = [];
          e.nativeTypeWeight = [6, 5, 0, 1, 3, 4, 2];
          e.curNative = null;
          e.firstGetNativeTime = 0;
          return e;
        }

        Object.defineProperty(a.prototype, "bannerCloseTimesToday", {
          get: function get() {
            var e = c.Helper.getTodayDate();
            d.getValue("bannerTimes" + e) || d.setValue("bannerTimes" + e, 0);
            return parseInt(cc.sys.localStorage.getItem("bannerTimes" + e));
          },
          set: function set(e) {
            d.setValue("bannerTimes" + c.Helper.getTodayDate(), e);
          },
          enumerable: !1,
          configurable: !0
        });

        a.prototype.init = function () {
          this.initAds();
        };

        a.prototype.initAds = function () {
          var e = this,
              t = this;
          qg.initAdService({
            appId: Config.OPPO.mediaId,
            isDebug: !1,
            success: function success() {
              t.initNative();
            },
            fail: function fail() {
              console.log("initAdService fail");
            },
            complete: function complete() {}
          });
          qg.onShow(function () {
            if (e.insertAD) {
              e.insertAD.offLoad();
              e.insertAD.offShow();
              e.insertAD.offError();
              e.insertAD.offClose();
              e.insertAD.destroy();
            }
          });
          qg.onHide(function () {});
        };

        a.prototype.initBanner = function () {
          if (this.bannerAD) {
            this.bannerAD.offLoad();
            this.bannerAD.offShow();
            this.bannerAD.offHide();
            this.bannerAD.offError();
            this.bannerAD.destroy();
          }

          this.bannerAD = qg.createBannerAd({
            posId: Config.OPPO.bannerId
          });
          var e = this;
          setTimeout(function () {
            e.bannerAD.show();
          }, 1e3);
          this.bannerAD.onLoad(function () {});
          this.bannerAD.onShow(function () {});
          this.bannerAD.onHide(function () {
            e.bannerCloseTimesToday++;
            console.log("用户主动关闭Banner", e.bannerCloseTimesToday, "次");
          });
          this.bannerAD.onError(function (e) {
            e && console.log("banner onError");
          });
        };

        a.prototype.showBanner = function () {
          console.log("废弃Banner");
        };

        a.prototype.closeBanner = function () {};

        a.prototype.initVideo = function () {
          var e = this;

          if (cc.sys.platform == cc.sys.OPPO_GAME) {
            this.videoAD && this.videoAD.destroy();
            this.videoAD = qg.createRewardedVideoAd({
              posId: Config.OPPO.videoId
            });
            setTimeout(function () {
              e.videoAD.load();
            }, 200);
            var t = this;
            this.videoAD.onLoad(function () {
              t.isVideoLoaded = !0;
              t.videoAD.show();
              t.videoAD.offLoad(function () {});
            });
            this.videoAD.onVideoStart(function () {
              t.videoAD.offVideoStart(function () {});
            });
            this.videoAD.onClose(function (e) {
              t.isVideoLoaded = !1;

              if (t.videoCallback) {
                e.isEnded ? t.videoCallback(n.AdsCode.finish) : t.videoCallback(n.AdsCode.cancel);
                t.videoCallback = null;
              }

              t.videoAD.offClose(function () {});
            });
            this.videoAD.onError(function (e) {
              e && console.log("videoAd onError", JSON.stringify(e));
              t.videoCallback && t.videoCallback(n.AdsCode.error);
              t.videoAD.offError(function () {});
            });
          }
        };

        a.prototype.canShowVideo = function () {
          return !0;
        };

        a.prototype.showVideo = function (e) {
          if (cc.sys.platform == cc.sys.OPPO_GAME) {
            this.videoCallback = e;
            this.initVideo();
          } else e && e(n.AdsCode.error);
        };

        a.prototype.initNative = function () {
          console.log("initNative");
          var n = this,
              i = qg.createNativeAd({
            posId: Config.OPPO.nativeId
          });
          setTimeout(function () {
            i.load();
          }, 500);
          setInterval(function () {
            if (n.nativeDataArr.length < 3) i.load();else {
              console.log("native full ");

              if (n.nativeDataArr[2].weight >= 3) {
                var e = n.nativeDataArr.pop();
                console.log("remove native", JSON.stringify(e));
                i.load();
              }
            }
          }, 1e4);
          setInterval(function () {
            n.freshNative();
          }, 1e3 * t.Mgr.Inst.nativeFreshTime);

          var a = function a(e, t) {
            var n = e.weight,
                o = t.weight;
            return n < o ? -1 : n > o ? 1 : 0;
          };

          i.onLoad(function (t) {
            console.log("native onLoad");
            t.adList.forEach(function (t) {
              var o = new e.Native();
              o.ad = i;
              o.adId = t.adId;
              o.title = t.title;
              o.desc = t.desc;
              o.iconUrl = t.icon;
              o.imgUrl = t.imgUrlList[0];
              o.clickBtnTxt = t.clickBtnTxt;
              o.interactionType = t.interactionType;
              o.weight = n.nativeTypeWeight[t.interactionType];
              n.nativeDataArr.push(o);
              n.nativeDataArr.sort(a);
              n.curNative || (n.curNative = o);
            });
            o.Event.emit("onGetNativeAd");
          });
          i.onError(function (e) {
            e && console.log("native onError", JSON.stringify(e));
          });
        };

        a.prototype.hasNative = function () {
          return !(l.Inst.gameTime < l.Inst.adProtectTime) && null != this.curNative;
        };

        a.prototype.getNative = function () {
          return this.curNative;
        };

        a.prototype.freshNative = function () {
          this.nativeDataArr.length > 0 && (this.curNative = this.nativeDataArr.splice(0, 1)[0]);
        };

        a.prototype.clickNative = function () {
          console.log("点击原生广告，当前原生广告置空");
        };

        return a;
      }(o.AdsBase);

      e.Ads = a;

      var r = function (e) {
        __extends(t, e);

        function t() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.ad = null;
          t.adId = "";
          t.hasShow = !1;
          return t;
        }

        t.prototype.show = function () {
          if (this.hasShow) console.log("原生广告已展示，不再重复展示", this.adId);else {
            this.hasShow = !0;
            console.log("原生广告展示", this.adId);
            this.ad.reportAdShow({
              adId: this.adId
            });
          }
        };

        t.prototype.click = function () {
          this.ad.reportAdClick({
            adId: this.adId
          });
          l.Inst.customData && "false" == l.Inst.customData.nativeNotFresh && o.Event.emit("onFreshNativeAdData", this.adId);
        };

        return t;
      }(o.NativeBase);

      e.Native = r;

      var s = function () {
        function e() {
          this.bannerAD = void 0;
          this.portalAD = void 0;
          this.drawerAD = void 0;
          this.boxReady = !1;
        }

        Object.defineProperty(e, "Inst", {
          get: function get() {
            if (null == e._INST) {
              e._INST = new e();

              e._INST.init();
            }

            return e._INST;
          },
          enumerable: !1,
          configurable: !0
        });

        e.prototype.init = function () {
          this.initBoxPortal();
          this.initDrawer();
        };

        e.prototype.hasBoxAd = function () {
          return qg.getSystemInfoSync().platformVersion >= 1076;
        };

        e.prototype.hasDrawerAd = function () {
          return qg.getSystemInfoSync().platformVersion >= 1090;
        };

        e.prototype.showBoxBanner = function () {
          if (this.hasBoxAd()) {
            if (this.bannerAD) {
              this.bannerAD.offLoad();
              this.bannerAD.offError();
              this.bannerAD.destroy();
            }

            this.bannerAD = qg.createGameBannerAd({
              posId: Config.OPPO.boxBannerId
            });
            var e = this;
            setTimeout(function () {
              e.bannerAD.show();
            }, 1e3);
            this.bannerAD.onLoad(function () {});
            this.bannerAD.onError(function (e) {
              e && console.log("boxBanner onError");
            });
          }
        };

        e.prototype.closeBoxBanner = function () {
          console.log("closeBoxBanner");
          cc.sys.platform == cc.sys.OPPO_GAME && this.hasBoxAd() && (this.bannerAD ? this.bannerAD.destroy() : console.log("boxBanner null"));
        };

        e.prototype.initBoxPortal = function () {
          var e = this;

          if (cc.sys.platform == cc.sys.OPPO_GAME && this.hasBoxAd()) {
            this.portalAD && this.portalAD.destroy();
            this.portalAD = qg.createGamePortalAd({
              adUnitId: Config.OPPO.boxPortalId
            });
            setTimeout(function () {
              e.portalAD.load();
            }, 200);
            var t = this;
            this.portalAD.onLoad(function () {
              t.boxReady = !0;
            });
            this.portalAD.onClose(function () {
              t.boxReady = !1;
              setTimeout(function () {
                e.portalAD.load();
              }, 200);
            });
            this.portalAD.onError(function (e) {
              e && console.log("portalAd onError", JSON.stringify(e));
            });
          }
        };

        e.prototype.boxPortalReady = function () {
          this.boxReady || this.portalAD && this.portalAD.load();
          return this.boxReady;
        };

        e.prototype.showBoxPortal = function () {
          cc.sys.platform == cc.sys.OPPO_GAME && this.hasBoxAd() && this.portalAD && this.portalAD.show();
        };

        e.prototype.initDrawer = function () {
          if (cc.sys.platform == cc.sys.OPPO_GAME && this.hasDrawerAd()) {
            this.drawerAD && this.drawerAD.destroy();
            this.drawerAD = qg.createGameDrawerAd({
              adUnitId: Config.OPPO.boxDrawerId
            });
            this.drawerAD.onShow(function () {
              console.log("drawer 广告显示");
            });
            this.drawerAD.onError(function (e) {
              e && console.log("drawerAD onError", JSON.stringify(e));
            });
            this.drawerAD.hide();
          }
        };

        e.prototype.showDrawer = function () {
          cc.sys.platform == cc.sys.OPPO_GAME && this.hasDrawerAd() && this.drawerAD && this.drawerAD.show().then(function () {
            console.log("show success");
          })["catch"](function (e) {
            console.log("show fail with:" + e.errCode + "," + e.errMsg);
          });
        };

        e.prototype.closeDrawer = function () {
          cc.sys.platform == cc.sys.OPPO_GAME && this.hasDrawerAd() && this.drawerAD && this.drawerAD.hide();
        };

        return e;
      }();

      e.Extend = s;
    })(e.OPPO || (e.OPPO = {}));

    (function (e) {
      var t = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {
          r.Inst.init();
          setTimeout(function () {}, 500);
        };

        t.prototype.login = function () {
          qg.authorize({
            type: "token",
            success: function success(e) {
              console.log("handling success, code: ", JSON.stringify(e));
            },
            fail: function fail(e, t) {
              console.log("handling fail, fail code: ", JSON.stringify(e), JSON.stringify(t));
            }
          });
        };

        t.prototype.vibrate = function () {
          qg.vibrateShort({
            success: function success() {},
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        t.prototype.vibrateLong = function () {
          qg.vibrateLong({
            success: function success() {},
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        return t;
      }(o.SdkBase);

      e.Sdk = t;

      var i = function (t) {
        __extends(i, t);

        function i() {
          var e = null !== t && t.apply(this, arguments) || this;
          e.nativeInsertPre = null;
          e.nativeDataArr = [];
          e.nativeIdArr = [];
          e.curNative = null;
          e.firstGetNativeTime = 0;
          return e;
        }

        i.prototype.init = function () {
          this.loadNativePre();
          this.initNative();
        };

        i.prototype.reInit = function () {
          this.init();
        };

        i.prototype.loadNativePre = function () {
          if (!this.nativeInsertPre) {
            var e = this;
            cc.loader.loadRes("SDK/NativeInsert", function (t, n) {
              null == t ? e.nativeInsertPre = n : console.log("err", t);
            });
          }
        };

        i.prototype.showBanner = function () {
          console.log("废弃Banner");
        };

        i.prototype.closeBanner = function () {};

        i.prototype.destoryBanner = function () {};

        i.prototype.showInsert = function (e) {
          if (this.canShowNativeInsert() && l.Inst.isAdOpen) this.showNativeInsert(e);else if (Config.VIVO.insertId) {
            this.insertAD = qg.createInterstitialAd({
              posId: Config.VIVO.insertId
            });
            var t = this.insertAD && this.insertAD.show();
            t && t.then(function () {
              console.log("展示插屏");
            })["catch"](function (e) {
              console.log("插屏广告展示异常", JSON.stringify(e));
            });
            this.insertAD.onLoad(function () {});
            this.insertAD.onClose(function () {});
            this.insertAD.onError(function () {});
          }
        };

        i.prototype.canShowVideo = function () {
          return !0;
        };

        i.prototype.showVideo = function (e) {
          var t = this;

          if (Config.VIVO.videoId) {
            var o = this;
            this.videoCallback = e;
            this.videoAD = qg.createRewardedVideoAd({
              posId: Config.VIVO.videoId,
              style: {}
            });
            var i = this.videoAD.load();
            l.Inst.pauseMusic();
            i && i.then(function () {
              setTimeout(function () {
                var e = o.videoAD && o.videoAD.show();
                e && e.then(function () {
                  console.log("展示激励");
                })["catch"](function (e) {
                  console.log("激励视频广告显示异常", JSON.stringify(e));
                  l.Inst.resumeMusic();
                });
              }, 600);
            })["catch"](function (e) {
              console.log("激励视频广告加载失败", JSON.stringify(e));
              l.Inst.resumeMusic();
            });
            this.videoAD.onLoad(function () {
              t.isVideoLoaded = !0;
            });
            this.videoAD.onError(function () {
              l.Inst.resumeMusic();
              o.videoCallback && o.videoCallback(n.AdsCode.error);
            });
            this.videoAD.onClose(function (e) {
              t.isVideoLoaded = !0;
              l.Inst.resumeMusic();

              if (o.videoCallback) {
                e && e.isEnded ? o.videoCallback(n.AdsCode.finish) : o.videoCallback(n.AdsCode.cancel);
                o.videoCallback = null;
              }
            });
          } else e && e(n.AdsCode.error);
        };

        i.prototype.initNative = function () {
          if (Config.VIVO.nativeId) {
            var t = this,
                n = qg.createCustomAd({
              posId: Config.VIVO.nativeId
            });
            setTimeout(function () {
              n.load();
            }, 500);
            setInterval(function () {
              t.nativeDataArr.length < 3 ? n.load() : console.log("native full ");
            }, 1e4);
            n.onLoad(function (i) {
              console.log("native onLoad ");
              i.adList.forEach(function (o) {
                if (-1 == t.nativeIdArr.indexOf(o.adId)) {
                  var i = new e.Native();
                  i.ad = n;
                  i.adId = o.adId;
                  i.title = o.title;
                  i.desc = o.desc;
                  i.iconUrl = o.icon;
                  i.imgUrl = o.imgUrlList[0];
                  t.nativeDataArr.push(i);
                  console.log("native add item id", o.adId);
                  t.nativeIdArr.push(o.adId);
                } else console.log("native continue id", o.adId);
              });
              o.Event.emit("onGetNativeAd");
            });
            n.onError(function (e) {
              e && console.log("native onError", JSON.stringify(e));
            });
          }
        };

        i.prototype.hasNative = function () {
          return this.nativeDataArr.length > 0 || null != this.curNative;
        };

        i.prototype.getNative = function () {
          if (!this.curNative || c.Helper.getCurTimeSecends() - this.firstGetNativeTime >= l.Inst.nativeFreshTime) {
            this.curNative ? console.log("原生广告过期:", c.Helper.getCurTimeSecends() - this.firstGetNativeTime) : console.log("首次获取原生广告");

            if (this.nativeDataArr.length > 0) {
              this.curNative = this.nativeDataArr.splice(0, 1)[0];
              this.firstGetNativeTime = c.Helper.getCurTimeSecends();
            } else console.log("未获取到原生广告");
          }

          return this.curNative;
        };

        i.prototype.clickNative = function () {
          console.log("点击原生广告，当前原生广告置空");
          this.curNative = null;
        };

        i.prototype.canShowNativeInsert = function () {
          return this.hasNative();
        };

        i.prototype.showNativeInsert = function (e) {
          var t = this.getNative();

          if (t) {
            this.createNative(t);
            this.closeBanner();
          } else if (e) {
            e(n.AdsCode.error);
            e = null;
          }
        };

        i.prototype.createNative = function (e) {
          var t = cc.instantiate(this.nativeInsertPre);
          t.getComponent("NativeInsertAd").showInsert(e, !0);
          cc.director.getScene().getChildByName("Canvas").addChild(t);
        };

        return i;
      }(o.AdsBase);

      e.Ads = i;

      var a = function (e) {
        __extends(t, e);

        function t() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.ad = null;
          t.adId = "";
          t.hasShow = !1;
          return t;
        }

        t.prototype.show = function () {
          if (this.hasShow) console.log("原生广告已展示，不再重复展示", this.adId);else {
            this.hasShow = !0;
            console.log("原生广告展示", this.adId);
            this.ad.reportAdShow({
              adId: this.adId
            });
          }
        };

        t.prototype.click = function () {
          this.ad.reportAdClick({
            adId: this.adId
          });
          o.Event.emit("onFreshNativeAdData", this.adId);
        };

        return t;
      }(o.NativeBase);

      e.Native = a;

      var r = function () {
        function e() {
          this.portalAD = void 0;
        }

        Object.defineProperty(e, "Inst", {
          get: function get() {
            null == e._INST && (e._INST = new e());
            return e._INST;
          },
          enumerable: !1,
          configurable: !0
        });

        e.prototype.init = function () {
          var e = this;
          setTimeout(function () {
            e.initBoxPortal();
          }, 500);
        };

        e.prototype.initBoxPortal = function () {
          if (cc.sys.platform == cc.sys.VIVO_GAME) {
            var e = this;

            if (qg.createBoxPortalAd) {
              this.portalAD = qg.createBoxPortalAd({
                posId: Config.VIVO.boxPortalId,
                image: "",
                marginTop: 200
              });
              this.portalAD.onError(function (e) {
                console.log("盒子九宫格广告加载失败", JSON.stringify(e));
              });
              this.portalAD.onClose(function () {
                e.portalAD.isDestroyed || e.portalAD.show();
              });
            } else console.log("暂不支持互推盒子相关 API");
          }
        };

        e.prototype.showBoxPortal = function () {
          cc.sys.platform == cc.sys.VIVO_GAME && (this.portalAD ? this.portalAD.show().then(function () {
            console.log("show success");
          }) : console.log("暂不支持互推盒子相关 API"));
        };

        return e;
      }();

      e.Extend = r;
    })(e.VIVO || (e.VIVO = {}));

    (function (e) {
      var i = function (e) {
        __extends(n, e);

        function n() {
          return null !== e && e.apply(this, arguments) || this;
        }

        n.prototype.init = function () {
          var e = this;
          setTimeout(function () {
            e.login();
          }, 500);
          qg.setKeepScreenOn({
            keepScreenOn: !0,
            success: function success() {
              console.log("setKeepScreenOn success");
            },
            fail: function fail() {
              console.log("setKeepScreenOn fail");
            },
            complete: function complete() {
              console.log("setKeepScreenOn complete");
            }
          });
        };

        n.prototype.login = function () {
          return;
          var e = this;
          qg.gameLoginWithReal({
            forceLogin: 1,
            appid: Config.HUAWEI.appId,
            success: function success(t) {
              console.log("Game login success:" + JSON.stringify(t));
              e.checkChild();
            },
            fail: function fail(e, t) {
              console.log("game login with real fail:" + JSON.stringify(e) + ", code:" + t);
            }
          });
        };

        n.prototype.checkChild = function () {
          return;
          var e = this,
              t = new Date().getTime().toString();
          qg.submitPlayerEvent({
            eventId: t,
            eventType: "GAMEBEGIN",
            success: function success(t) {
              console.log("submitPlayerEvent success", t);
              console.log("未成年");
              e.countChildTime();
            },
            fail: function fail(e, t) {
              console.log("submitPlayerEvent fail:" + e + ", code:" + t);
              console.log("已成年");
            }
          });
        };

        n.prototype.countChildTime = function () {
          return;
          var e = this;
          this.checkChildTime() || o.Event.emit("OpenChildProtect");
          setInterval(function () {
            e.checkChildTime() ? o.Event.emit("CloseChildProtect") : o.Event.emit("OpenChildProtect");
          }, 5e3);
        };

        n.prototype.checkChildTime = function () {
          return;
          var e = 0 == new Date().getDay() || 5 == new Date().getDay() || 6 == new Date().getDay(),
              n = -1 != ["2021-9-19", "2021-9-20", "2021-9-21", "2021-10-1", "2021-10-2", "2021-10-3", "2021-10-4", "2021-10-5", "2021-10-6", "2021-10-7", "2021-12-31", "2022-1-1", "2022-1-2", "2022-1-31", "2022-2-1", "2022-2-2", "2022-2-3", "2022-2-4", "2022-2-5", "2022-2-6", "2022-4-3", "2022-4-4", "2022-4-5", "2022-5-1", "2022-5-2", "2022-5-3", "2022-5-4", "2022-5-5", "2022-6-3", "2022-6-4", "2022-6-5", "2022-9-9", "2022-9-10", "2022-9-11", "2022-10-1", "2022-10-2", "2022-10-3", "2022-10-4", "2022-10-5", "2022-10-6", "2022-10-7"].indexOf(t.Util.Helper.getTodayDate()),
              o = 20 == new Date().getHours();
          e && console.log("今天是休息日");
          n && console.log("今天是节假日");
          o && console.log("现在是开放时间");

          if ((e || n) && o) {
            console.log("现在可以玩啦");
            return !0;
          }

          console.log("未成年不可玩时段");
          return !1;
        };

        n.prototype.vibrate = function () {
          qg.vibrateShort({
            success: function success() {},
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        n.prototype.vibrateLong = function () {
          qg.vibrateLong({
            success: function success() {},
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        n.prototype.quit = function () {
          qg.exitApplication({
            success: function success() {
              console.log("exitApplication success");
            },
            fail: function fail() {
              console.log("exitApplication fail");
            },
            complete: function complete() {
              console.log("exitApplication complete");
            }
          });
        };

        return n;
      }(o.SdkBase);

      e.Sdk = i;

      var a = function (e) {
        __extends(t, e);

        function t() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.nativeInsertPre = null;
          t.nativeDataArr = [];
          t.nativeIdArr = [];
          t.nativeAd = null;
          t.nativeAdInsert = null;
          t.curNative = null;
          t.firstGetNativeTime = 0;
          return t;
        }

        t.prototype.init = function () {
          this.initNativeInsert();
          this.initVideo();
          this.loadNativePre();
        };

        t.prototype.loadNativePre = function () {
          if (!this.nativeInsertPre) {
            var e = this;
            cc.loader.loadRes("SDK/HuaWeiNativeInsert", function (t, n) {
              null == t ? e.nativeInsertPre = n : console.log("err", t);
            });
          }
        };

        t.prototype.showBanner = function () {
          var e = qg.getSystemInfoSync(),
              t = (Math.floor(e.safeArea.right), Math.floor(e.safeArea.bottom));
          this.bannerAD = qg.createBannerAd({
            adUnitId: Config.HUAWEI.bannerId,
            style: {
              top: t - 75,
              left: 0,
              width: 360,
              height: 57
            }
          });
          var n = this.bannerAD && this.bannerAD.show();
          n && n.then(function () {
            console.log("展示banner");
          })["catch"](function (e) {
            console.log("展示banner异常", JSON.stringify(e));
          });
          this.bannerAD.onLoad(function () {
            console.log("banner加载");
          });
          this.bannerAD.onClose(function () {
            console.log("banner关闭");
          });
          this.bannerAD.onError(function (e) {
            console.log("banner错误", JSON.stringify(e));
          });
        };

        t.prototype.closeBanner = function () {
          this.bannerAD && this.bannerAD.hide();
        };

        t.prototype.destoryBanner = function () {
          this.bannerAD && this.bannerAD.destroy();
        };

        t.prototype.showInsert = function (e) {
          this.canShowNativeInsert() && this.showNativeInsert(e);
        };

        t.prototype.initVideo = function () {
          var e = this;
          this.videoAD = qg.createRewardedVideoAd({
            adUnitId: Config.HUAWEI.videoId,
            success: function success() {
              console.log("ad demo : loadAndShowVideoAd createRewardedVideoAd: success");
            },
            fail: function fail(e, t) {
              console.log("ad demo : loadAndShowVideoAd createRewardedVideoAd fail: " + e + "," + t);
            },
            complete: function complete() {
              console.log("ad demo : loadAndShowVideoAd createRewardedVideoAd complete");
            }
          });
          this.videoAD.onLoad(function () {
            console.log("videoAD.onLoad");
            e.isVideoLoaded = !0;
          });
          this.videoAD.onError(function (e) {
            l.Inst.resumeMusic();
            console.error("videoAD.onError:" + JSON.stringify(e));
            e.errCode, e.errMsg;
          });
          this.videoAD.onClose(function (t) {
            console.log("videoAD.onClose: " + t.isEnded);
            e.isVideoLoaded = !1;
            e.videoAD.load();
            l.Inst.resumeMusic();
            t.isEnded ? e.videoCallback && e.videoCallback(n.AdsCode.finish) : e.videoCallback && e.videoCallback(n.AdsCode.cancel);
          });
          this.videoAD.load();
          this.videoAD.setTagForChildProtection(-1);
          this.videoAD.setTagForUnderAgeOfPromise(-1);
          this.videoAD.setAdContentClassification("A");
          this.videoAD.setNonPersonalizedAd(0);
        };

        t.prototype.canShowVideo = function () {
          this.isVideoLoaded || this.videoAD.load();
          return this.isVideoLoaded;
        };

        t.prototype.showVideo = function (e) {
          if (this.isVideoLoaded) {
            this.videoCallback = e;
            this.videoAD.show();
            l.Inst.pauseMusic();
          } else e && e(n.AdsCode.error);
        };

        t.prototype.initNative = function () {};

        t.prototype.hasNative = function () {
          return this.nativeDataArr.length > 0 || null != this.curNative;
        };

        t.prototype.getNative = function () {
          if (!this.curNative || c.Helper.getCurTimeSecends() - this.firstGetNativeTime >= l.Inst.nativeFreshTime) {
            this.curNative ? console.log("原生广告过期:", c.Helper.getCurTimeSecends() - this.firstGetNativeTime) : console.log("首次获取原生广告");

            if (this.nativeDataArr.length > 0) {
              this.curNative = this.nativeDataArr.splice(0, 1)[0];
              this.firstGetNativeTime = c.Helper.getCurTimeSecends();
            } else console.log("未获取到原生广告");
          }

          return this.curNative;
        };

        t.prototype.clickNative = function () {
          console.log("点击原生广告，当前原生广告置空");
          this.curNative = null;
        };

        t.prototype.initNativeInsert = function () {};

        t.prototype.canShowNativeInsert = function () {
          return !0;
        };

        t.prototype.showNativeInsert = function () {
          this.createNativeInsert();
        };

        t.prototype.createNativeInsert = function () {
          var e = cc.instantiate(this.nativeInsertPre);
          e.getComponent("NativeAd_Huawei_Single").show();
          cc.director.getScene().getChildByName("Canvas").addChild(e);
        };

        return t;
      }(o.AdsBase);

      e.Ads = a;

      var r = function (e) {
        __extends(t, e);

        function t() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.ad = null;
          t.adId = "";
          t.hasShow = !1;
          return t;
        }

        t.prototype.show = function () {
          if (this.hasShow) console.log("原生广告已展示，不再重复展示", this.adId);else {
            this.hasShow = !0;
            console.log("原生广告展示", this.adId);
            this.ad.reportAdShow({
              adId: this.adId
            });
          }
        };

        t.prototype.click = function () {
          this.ad.reportAdClick({
            adId: this.adId
          });
        };

        return t;
      }(o.NativeBase);

      e.Native = r;
    })(e.HUAWEI || (e.HUAWEI = {}));

    (function (e) {
      var t = function (e) {
        __extends(t, e);

        function t() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.hasLogin = !1;
          t.loginCode = "";
          t.loginAnonymousCode = "";
          return t;
        }

        Object.defineProperty(t.prototype, "isWifi", {
          get: function get() {
            return parseInt(tt.getSystemInfoSync().wifiSignal) > 0;
          },
          enumerable: !1,
          configurable: !0
        });

        t.getAppName = function () {
          return tt.getSystemInfoSync().appName;
        };

        t.prototype.jump = function () {
          tt.openAwemeUserProfile();
        };

        t.prototype.checkUpdate = function () {
          if ("function" == typeof tt.getUpdateManager) {
            var e = tt.getUpdateManager();
            e.onCheckForUpdate(function () {});
            e.onUpdateReady(function () {
              e.applyUpdate();
            });
            e.onUpdateFailed(function () {});
          }
        };

        t.prototype.init = function () {
          this._isWifi = parseInt(tt.getSystemInfoSync().wifiSignal) > 0;
        };

        t.prototype.login = function () {};

        t.prototype.promo = function (e, t) {
          if ("ios" !== tt.getSystemInfoSync().platform) tt.showMoreGamesModal({
            appLaunchOptions: [{
              appId: Config.TT.appId,
              query: "source=" + e.key,
              extraData: {}
            }],
            success: function success(e) {
              console.log("success", e.errMsg);

              if (t) {
                t(!0);
                t = null;
              }
            },
            fail: function fail(e) {
              console.log("fail", e.errMsg);

              if (t) {
                t(!1);
                t = null;
              }
            }
          });else if (t) {
            t(!1);
            t = null;
          }
        };

        t.prototype.vibrate = function () {
          tt.vibrateShort({
            success: function success() {},
            fail: function fail() {}
          });
        };

        t.prototype.vibrateLong = function () {
          tt.vibrateLong({
            success: function success() {},
            fail: function fail() {}
          });
        };

        return t;
      }(o.SdkBase);

      e.Sdk = t;

      var i = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {
          var e = this;
          setTimeout(function () {
            e.initVideo();
          }, 500);
        };

        t.prototype.initBanner = function () {
          var e = this;

          if ("function" == typeof tt.createBannerAd) {
            this.bannerAD && this.bannerAD.destroy();

            if (Config.TT.bannerId) {
              var t = tt.getSystemInfoSync(),
                  n = (Math.floor(t.windowWidth), Math.floor(t.windowHeight)),
                  o = 208;
              this.bannerAD = tt.createBannerAd({
                adUnitId: Config.TT.bannerId,
                style: {
                  width: o,
                  top: n - o / 2.85
                }
              });
              this.bannerAD.style.left = (t.windowWidth - o) / 2;
              this.bannerAD.onResize(function (n) {
                console.log(n.width, n.height);

                if (o != n.width) {
                  o = n.width;
                  e.bannerAD.style.top = t.windowHeight - o / 2.85;
                  e.bannerAD.style.left = (t.windowWidth - o) / 2;
                }
              });
              this.bannerAD.onLoad(function () {
                console.log("banner onLoad");
                e.bannerAD.show().then(function () {
                  console.log("showBanner success");
                })["catch"](function (e) {
                  console.log("showBanner error", JSON.stringify(e));
                });
              });
              this.bannerAD.onError(function (e) {
                console.log("banner onError", JSON.stringify(e));
              });
            }
          }
        };

        t.prototype.showBanner = function () {
          l.Inst.isAdOpen && this.initBanner();
        };

        t.prototype.closeBanner = function () {
          if (this.bannerAD) {
            console.log("closeBanner ");
            this.bannerAD.destroy();
          }
        };

        t.prototype.showInsert = function () {
          var e = this;

          if ("function" == typeof tt.createInterstitialAd && Config.TT.insertId) {
            this.insertAD = tt.createInterstitialAd({
              adUnitId: Config.TT.insertId
            });
            setTimeout(function () {
              e.insertAD.load().then(function () {
                e.insertAD.show();
              })["catch"](function (e) {
                console.log(e);
              });
            }, 500);
          }
        };

        t.prototype.initVideo = function () {
          var e = this;

          if ("function" == typeof tt.createRewardedVideoAd && Config.TT.videoId) {
            var t = this;
            this.videoAD = tt.createRewardedVideoAd({
              adUnitId: Config.TT.videoId
            });
            this.videoAD.onLoad(function () {
              console.log("Video onLoad");
              e.isVideoLoaded = !0;
            });
            this.videoAD.onError(function (e) {
              console.log("Video onError", JSON.stringify(e));
            });
            this.videoAD.onClose(function (e) {
              e && e.isEnded || void 0 === e ? t.videoCallback(n.AdsCode.finish) : t.videoCallback(n.AdsCode.cancel);
              t.videoCallback = void 0;
            });
          }
        };

        t.prototype.canShowVideo = function () {
          console.log("canShowVideo:" + this.isVideoLoaded);
          !this.isVideoLoaded && this.videoAD ? this.videoAD.load() : this.videoAD || this.initVideo();
          return this.isVideoLoaded;
        };

        t.prototype.showVideo = function (e) {
          console.log("showVideo");
          this.videoCallback = e;
          var t = this;

          if (this.videoAD) {
            if (this.canShowVideo()) this.videoAD.show().then(function () {
              console.log("视频广告展示");
            })["catch"](function () {
              if (t.videoCallback) {
                t.videoCallback(n.AdsCode.error);
                t.videoCallback = null;
              }
            });else if (this.videoCallback) {
              this.videoCallback(n.AdsCode.error);
              this.videoCallback = null;
            }
          } else {
            this.initVideo();

            if (this.videoCallback) {
              this.videoCallback(n.AdsCode.error);
              this.videoCallback = null;
            }
          }
        };

        return t;
      }(o.AdsBase);

      e.Ads = i;

      var a = function (e) {
        __extends(t, e);

        function t() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.recordPath = void 0;
          t.recorder = null;
          t.surpportRecord = !1;
          t.isClipRecord = !1;
          return t;
        }

        t.prototype.init = function () {
          var e = this;
          tt.showShareMenu();
          tt.onShareAppMessage(function () {
            return {
              title: Config.TT.shareTitle,
              imageUrl: Config.TT.shareImageUrl
            };
          });
          tt.onShow(function (e) {
            console.log("onShow ", JSON.stringify(e));
          });
          tt.onHide(function () {
            console.log("onHide");
          });
          setTimeout(function () {
            if ("function" == typeof tt.getGameRecorderManager) {
              e.surpportRecord = !0;
              e.recorder = tt.getGameRecorderManager();
              var t = e;
              e.recorder.onStart(function () {
                console.log("recorder onStart");
              });
              e.recorder.onStop(function (e) {
                console.log("recorder onStop");
                if (t.isClipRecord) t.recorder.clipVideo({
                  path: e.videoPath,
                  success: function success(e) {
                    t.recordPath = e.videoPath;
                    console.log("recordPath:", t.recordPath);
                  }
                });else {
                  t.recordPath = e.videoPath;
                  console.log("recordPath:", t.recordPath);
                }
              });
              e.recorder.onError(function (e) {
                console.log("recorder onError", e);
                t.recordPath = void 0;
              });
            } else e.surpportRecord = !1;
          }, 500);
        };

        t.prototype.shareNormal = function (e) {
          tt.shareAppMessage({
            title: Config.TT.shareTitle,
            imageUrl: Config.TT.shareImageUrl,
            templateId: Config.TT.shareTemplateId,
            success: function success() {
              console.log("share success");
              e && e(n.ShareCode.success);
            },
            fail: function fail(t) {
              console.log("share fail:", JSON.stringify(t));
              e && e(n.ShareCode.fail);
            }
          });
        };

        t.prototype.startRecord = function (e) {
          void 0 === e && (e = -1);

          if (this.surpportRecord) {
            (e < 0 || e < 120) && (e = 120);
            this.recorder.start({
              duration: e
            });
          }
        };

        t.prototype.recordClip = function (e, t) {
          void 0 === e && (e = 3);
          void 0 === t && (t = 3);
          this.recorder.recordClip({
            timeRange: [e, t]
          });
        };

        t.prototype.stopRecord = function (e) {
          void 0 === e && (e = !1);

          if (this.surpportRecord) {
            console.log("stopRecord");
            this.recorder.stop();
          }
        };

        t.prototype.canShare = function () {
          return !(!this.surpportRecord || null == this.recordPath);
        };

        t.prototype.share = function (e) {
          if (this.surpportRecord) {
            if (null != this.recordPath) {
              console.log("recordPath:", this.recordPath);
              tt.shareAppMessage({
                channel: "video",
                title: Config.TT.shareTitle,
                desc: Config.TT.shareDesc,
                imageUrl: Config.TT.shareImageUrl,
                templateId: Config.TT.shareTemplateId,
                query: "",
                extra: {
                  videoPath: this.recordPath,
                  videoTopics: Config.TT.shareTopics,
                  hashtag_list: Config.TT.shareTopics,
                  withVideoId: !0,
                  createChallenge: !0
                },
                success: function success() {
                  console.log("分享成功！");
                  tt.reportAnalytics("ShareVideo", {
                    action: "success"
                  });
                  e && e(n.ShareCode.success);
                },
                fail: function fail(t) {
                  console.log("分享失败！", t);

                  if (t.errMsg.includes("shareAppMessage:fail video file is too short")) {
                    tt.reportAnalytics("ShareVideo", {
                      action: "fail"
                    });
                    e && e(n.ShareCode.tooShort);
                  } else if (t.errMsg.includes("shareAppMessage:fail video duration is too short")) {
                    tt.reportAnalytics("ShareVideo", {
                      action: "fail"
                    });
                    e && e(n.ShareCode.tooShort);
                  } else if (t.errMsg.includes("shareAppMessage:fail")) {
                    tt.reportAnalytics("ShareVideo", {
                      action: "fail"
                    });
                    e && e(n.ShareCode.fail);
                  } else if (t.errMsg.includes("shareAppMessage:cancel")) {
                    tt.reportAnalytics("ShareVideo", {
                      action: "cancel"
                    });
                    e && e(n.ShareCode.cancel);
                  }
                }
              });
            } else {
              console.log("recordPath is null");
              e && e(n.ShareCode.pathNull);
            }
          } else e && e(n.ShareCode.error);
        };

        return t;
      }(o.ShareBase);

      e.Share = a;
    })(e.TT || (e.TT = {}));

    (function (e) {
      var t = function (e) {
        __extends(t, e);

        function t() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.hasLogin = !1;
          t.loginCode = "";
          t.loginAnonymousCode = "";
          return t;
        }

        t.prototype.init = function () {
          this.checkUpdate();
          this.login();
        };

        t.prototype.checkUpdate = function () {
          if ("function" == typeof wx.getUpdateManager) {
            var e = wx.getUpdateManager();
            e.onCheckForUpdate(function (e) {
              console.log("onCheckForUpdate: " + e.hasUpdate);
            });
            e.onUpdateReady(function () {
              console.log("onUpdateReady");
              e.applyUpdate();
            });
            e.onUpdateFailed(function () {
              console.error("onUpdateFailed");
            });
          }
        };

        t.prototype.login = function () {
          var e = this;
          wx.login({
            success: function success(t) {
              console.log("login success " + t.code + " " + t.anonymousCode);
              e.loginCode = t.code;
              e.loginAnonymousCode = t.anonymousCode;
              e.hasLogin = !0;
            },
            fail: function fail(t) {
              console.log("login fail :", t);
              e.hasLogin = !1;
            }
          });
        };

        return t;
      }(o.SdkBase);

      e.Sdk = t;

      var i = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {
          this.initBanner();
          this.initInsert();
          this.initVideo();
        };

        t.prototype.initBanner = function () {
          var e = this;
          this.bannerAD && this.bannerAD.destroy();
          var t = wx.getSystemInfoSync(),
              n = Math.floor(t.windowWidth),
              o = Math.floor(t.windowHeight);
          this.bannerAD = wx.createBannerAd({
            adUnitId: Config.WX.bannerId,
            adIntervals: 30,
            style: {
              width: 200,
              top: o - 112.5
            }
          });
          var i = (n - 200) / 4;
          this.bannerAD.style.left = i;
          this.bannerAD.onLoad(function () {
            console.log("banner onLoad");
          });
          this.bannerAD.onError(function (e) {
            console.log("banner onError", JSON.stringify(e));
          });
          this.bannerAD.onResize(function (t) {
            console.log(t.width, t.height);
            e.bannerAD.style.left = .5 * (n - e.bannerAD.style.realWidth);
            e.bannerAD.style.top = o - e.bannerAD.style.realHeight;
          });
        };

        t.prototype.showBanner = function () {
          if (this.bannerAD) {
            console.log("showBanner ");
            this.bannerAD.show().then(function () {
              console.log("showBanner success");
            })["catch"](function (e) {
              console.log("showBanner error", JSON.stringify(e));
            });
          } else this.initBanner();
        };

        t.prototype.closeBanner = function () {
          if (this.bannerAD) {
            console.log("closeBanner ");
            this.bannerAD.hide();
          }
        };

        t.prototype.initInsert = function () {
          var e = this;
          this.insertAD = wx.createInterstitialAd({
            adUnitId: Config.WX.insertId
          });
          this.insertAD.onLoad(function () {
            console.log("insert 广告加载成功");
          });
          this.insertAD.onError(function (e) {
            console.log("insert 广告加载错误：", JSON.stringify(e));
          });
          this.insertAD.onClose(function () {
            console.log("insert 广告关闭");
            setTimeout(function () {
              e.insertAD.load();
            }, 200);
          });
          setTimeout(function () {
            e.insertAD.load();
          }, 200);
        };

        t.prototype.showInsert = function () {
          if (this.insertAD) {
            console.log("显示insert ");
            this.insertAD.show().then(function () {
              console.log("广告显示成功");
            })["catch"](function (e) {
              console.log("广告组件出现问题", JSON.stringify(e));
            });
          } else this.initInsert();
        };

        t.prototype.initVideo = function () {
          var e = this;
          this.videoAD = wx.createRewardedVideoAd({
            adUnitId: Config.WX.videoId,
            multiton: !0
          });
          setTimeout(function () {
            e.videoAD.load();
          }, 500);
          this.videoAD.onLoad(function () {
            console.log("Video onLoad");
            e.isVideoLoaded = !0;
          });
          this.videoAD.onError(function (e) {
            console.log("Video onError", JSON.stringify(e));
            l.Inst.resumeMusic();
          });
          this.videoAD.onClose(function (t) {
            l.Inst.resumeMusic();
            e.isVideoLoaded = !1;
            t && t.isEnded || void 0 === t ? e.videoCallback(n.AdsCode.finish) : e.videoCallback(n.AdsCode.cancel);
            e.videoCallback = void 0;
            setTimeout(function () {
              e.videoAD.load();
            }, 500);
          });
        };

        t.prototype.canShowVideo = function () {
          console.log("canShowVideo:" + this.isVideoLoaded);
          !this.isVideoLoaded && this.videoAD && this.videoAD.load();
          return this.isVideoLoaded;
        };

        t.prototype.showVideo = function (e) {
          console.log("showVideo");
          this.videoCallback = e;

          if (this.videoAD) {
            this.videoAD.show();
            l.Inst.pauseMusic();
          } else {
            this.initVideo();

            if (this.videoCallback) {
              this.videoCallback(n.AdsCode.error);
              this.videoCallback = null;
            }
          }
        };

        return t;
      }(o.AdsBase);

      e.Ads = i;

      var a = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {
          wx.showShareMenu();
          wx.onShareAppMessage(function () {
            return {
              title: Config.WX.shareTitle,
              imageUrl: Config.WX.shareImageUrl
            };
          });
          wx.onShow(function (e) {
            console.log("onShow ", JSON.stringify(e));
          });
          wx.onHide(function () {
            console.log("onHide");
          });
        };

        t.prototype.share = function (e) {
          wx.shareAppMessage({
            title: Config.WX.shareTitle,
            imageUrl: Config.WX.shareImageUrl,
            success: function success() {
              console.log("share success");
              e && e(n.ShareCode.success);
            },
            fail: function fail(t) {
              console.log("share fail:", JSON.stringify(t));
              e && e(n.ShareCode.fail);
            }
          });
        };

        return t;
      }(o.ShareBase);

      e.Share = a;
    })(e.WX || (e.WX = {}));

    (function (e) {
      var t = function (e) {
        __extends(t, e);

        function t() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.hasLogin = !1;
          t.loginCode = "";
          return t;
        }

        t.prototype.init = function () {
          this.checkUpdate();
          this.login();
        };

        t.prototype.checkUpdate = function () {
          if ("function" == typeof qq.getUpdateManager) {
            console.log("checkUpdate");
            var e = qq.getUpdateManager();
            e.onCheckForUpdate(function (e) {
              console.log("onCheckForUpdate: ", e.hasUpdate);
            });
            e.onUpdateReady(function () {
              console.log("onUpdateReady");
              e.applyUpdate();
            });
            e.onUpdateFailed(function () {
              console.error("onUpdateFailed");
            });
          }
        };

        t.prototype.login = function () {
          var e = this;
          qq.login({
            success: function success(t) {
              console.log("login success " + t.code);
              e.loginCode = t.code;
              e.hasLogin = !0;
            },
            fail: function fail(t) {
              console.log("login fail :", t);
              e.hasLogin = !1;
            }
          });
        };

        return t;
      }(o.SdkBase);

      e.Sdk = t;

      var i = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {
          this.bannerId = Config.QQ.bannerId;
          this.insertId = Config.QQ.insertId;
          this.videoId = Config.QQ.videoId;
          this.initBanner();
          this.initInsert();
          this.initVideo();
        };

        t.prototype.initBanner = function () {
          if (cc.sys.platform == cc.sys.WECHAT_GAME && "function" == typeof qq.createBannerAd) {
            this.bannerAD && this.bannerAD.destroy();
            var e = qq.getSystemInfoSync(),
                t = {};

            if (e.windowWidth < e.windowHeight) {
              t.width = e.windowWidth;
              t.height = .25 * t.width;
              t.left = (e.windowWidth - t.width) / 2;
              t.top = e.windowHeight - t.height;
            } else {
              t.width = 300;
              t.height = .25 * t.width;
              t.left = (e.windowWidth - t.width) / 2;
              t.top = e.windowHeight - t.height;
            }

            this.bannerAD = qq.createBannerAd({
              adUnitId: this.bannerId,
              style: {
                left: t.left,
                width: t.width,
                top: t.top
              }
            });
            this.bannerAD.onLoad(function () {
              console.log("banner 广告加载成功");
            });
            this.bannerAD.onError(function (e) {
              console.log("banner 广告加载错误：", JSON.stringify(e));
            });
            var n = this;
            this.bannerAD.onResize(function (o) {
              console.log("banner 广告加载错误：", JSON.stringify(o));

              if (o.width > 0 && o.height > 0) {
                t.width = o.width;
                t.height = o.height;
                t.left = (e.windowWidth - t.width) / 2;
                t.top = e.windowHeight - t.height;
                n.bannerAD.style.left != t.left && (n.bannerAD.style.left = t.left);
                n.bannerAD.style.top != t.top && (n.bannerAD.style.top = t.top);
              }
            });
          }
        };

        t.prototype.showBanner = function () {
          if (this.bannerAD) {
            console.log("显示banner ");
            this.bannerAD.show().then(function () {
              console.log("广告显示成功");
            })["catch"](function (e) {
              console.log("广告组件出现问题", JSON.stringify(e));
            });
          } else this.initBanner();
        };

        t.prototype.closeBanner = function () {
          if (this.bannerAD) {
            console.log("隐藏banner ");
            this.bannerAD.hide();
          }
        };

        t.prototype.initInsert = function () {
          var e = this;
          this.insertAD = qq.createInterstitialAd({
            adUnitId: this.insertId
          });
          this.insertAD.onLoad(function () {
            console.log("insert 广告加载成功");
          });
          this.insertAD.onError(function (e) {
            console.log("insert 广告加载错误：", JSON.stringify(e));
          });
          this.insertAD.onClose(function () {
            console.log("insert 广告关闭");
            setTimeout(function () {
              e.insertAD.load();
            }, 200);
          });
          setTimeout(function () {
            e.insertAD.load();
          }, 200);
        };

        t.prototype.showInsert = function () {
          if (this.insertAD) {
            console.log("显示insert ");
            this.insertAD.show().then(function () {
              console.log("广告显示成功");
            })["catch"](function (e) {
              console.log("广告组件出现问题", JSON.stringify(e));
            });
          } else this.initInsert();
        };

        t.prototype.initVideo = function () {
          var e = this;

          if (cc.sys.platform == cc.sys.WECHAT_GAME && "function" == typeof qq.createRewardedVideoAd) {
            var t = this;
            this.videoAD = qq.createRewardedVideoAd({
              adUnitId: this.videoId
            });
            this.videoAD.onLoad(function () {
              e.isVideoLoaded = !0;
              console.log("激励视频 广告加载成功");
            });
            this.videoAD.onError(function (e) {
              console.log("暂无视频，请稍后再试", JSON.stringify(e));
            });
            this.videoAD.onClose(function (o) {
              o && o.isEnded || void 0 === o ? t.videoCallback(n.AdsCode.finish) : t.videoCallback(n.AdsCode.cancel);
              t.videoCallback = void 0;
              setTimeout(function () {
                e.videoAD.load();
              }, 200);
            });
            setTimeout(function () {
              e.videoAD.load();
            }, 200);
          }
        };

        t.prototype.canShowVideo = function () {
          console.log("视频是否可用:" + this.isVideoLoaded);
          !this.isVideoLoaded && this.videoAD && this.videoAD.load();
          return this.isVideoLoaded;
        };

        t.prototype.showVideo = function (e) {
          console.log("########## 展示视频 ##########");
          this.videoCallback = e;
          if (this.videoAD) this.videoAD.show();else {
            this.initVideo();

            if (this.videoCallback) {
              this.videoCallback(n.AdsCode.error);
              this.videoCallback = null;
            }
          }
        };

        return t;
      }(o.AdsBase);

      e.Ads = i;

      var a = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {
          qq.showShareMenu({
            showShareItems: ["qq", "qzone"],
            withShareTicket: !0
          });
          qq.onShareAppMessage(function () {
            return {
              title: Config.QQ.shareTitle,
              imageUrl: Config.QQ.shareImageUrl
            };
          });
          qq.onShow(function (e) {
            console.log("返回前台：", JSON.stringify(e));
          });
          qq.onHide(function () {
            console.log("隐藏到后台");
          });
        };

        t.prototype.share = function (e) {
          var t = new Date().getTime(),
              o = !1;
          qq.shareAppMessage({
            title: Config.QQ.shareTitle,
            imageUrl: Config.QQ.shareImageUrl,
            success: function success() {
              console.log("分享成功！");
              o = !0;
            },
            fail: function fail(e) {
              console.log("分享失败:", JSON.stringify(e));
              o = !1;
            },
            complete: function complete() {
              console.log("分享完成", o);
              e && setTimeout(function () {
                if (o) {
                  var i = new Date().getTime();
                  console.log(i, t);

                  if (i - t >= 3e3) {
                    console.log("时间超过3秒");
                    e(n.ShareCode.success);
                  } else {
                    console.log("时间少于3秒");
                    e(n.ShareCode.fail);
                  }
                } else e(n.ShareCode.fail);
              }, 500);
            }
          });
        };

        return t;
      }(o.ShareBase);

      e.Share = a;

      var r = function () {
        function e() {
          this.appBoxAD = void 0;
          this.boxReady = !1;
        }

        Object.defineProperty(e, "Inst", {
          get: function get() {
            if (null == e._INST) {
              e._INST = new e();

              e._INST.init();
            }

            return e._INST;
          },
          enumerable: !1,
          configurable: !0
        });

        e.prototype.init = function () {
          this.initAppBox();
        };

        e.prototype.initAppBox = function () {
          var e = this;
          this.appBoxAD = qq.createAppBox({
            adUnitId: Config.QQ.appBoxId
          });
          setTimeout(function () {
            e.appBoxAD.load();
          }, 200);
          var t = this;
          this.appBoxAD.onClose(function () {
            t.boxReady = !1;
            setTimeout(function () {
              e.appBoxAD.load();
            }, 200);
          });
        };

        e.prototype.appBoxReady = function () {
          return !0;
        };

        e.prototype.showAppBox = function () {
          this.appBoxAD && this.appBoxAD.show();
        };

        return e;
      }();

      e.Extend = r;
    })(e.QQ || (e.QQ = {}));

    (function (e) {
      var t = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {};

        t.prototype.login = function () {};

        return t;
      }(o.SdkBase);

      e.Sdk = t;

      var i = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {};

        t.prototype.showBanner = function () {
          var e = gamebox.getSystemInfoSync().pixelRatio,
              t = Math.floor(gamebox.getSystemInfoSync().windowWidth * e * .9),
              n = Math.floor(gamebox.getSystemInfoSync().windowWidth * e * .05);

          if (gamebox.getSystemInfoSync().windowWidth > gamebox.getSystemInfoSync().windowHeight) {
            t = Math.floor(gamebox.getSystemInfoSync().windowWidth * e * .5);
            n = Math.floor(gamebox.getSystemInfoSync().windowWidth * e * .25);
          }

          var o = Math.floor(.2 * t),
              i = Math.floor(gamebox.getSystemInfoSync().windowHeight * e) - o;
          this.bannerAD = gamebox.createBannerAd({
            style: {
              width: t,
              height: o,
              left: n,
              top: i
            }
          });
          this.bannerAD.show()["catch"](function (e) {
            console.info("Banner 广告显示失败", e);
          });
          this.bannerAD.onLoad(function (e) {
            console.info("Banner onLoad" + e);
          });
          this.bannerAD.onError(function (e) {
            console.info("Banner onError" + e);
          });
        };

        t.prototype.closeBanner = function () {
          this.bannerAD && this.bannerAD.hide();
        };

        t.prototype.showInsert = function () {
          var e = gamebox.createInterstitialAd();
          e.show()["catch"](function () {
            e.load().then(function () {
              return e.show();
            })["catch"](function (e) {
              console.log("InterstitialAd 广告显示失败", e);
            });
          });
          e.onLoad(function (e) {
            console.info("InterstitialAd onLoad" + e);
          });
          e.onClose(function (e) {
            console.info("InterstitialAd onClose" + e);
          });
          e.onError(function (e) {
            console.info("InterstitialAd onError" + e);
          });
        };

        t.prototype.initVideo = function () {
          var e = this,
              t = this;
          this.videoAD = gamebox.createRewardedVideoAd();
          this.videoAD.onLoad(function (t) {
            console.log("Video onLoad", JSON.stringify(t));
            e.isVideoLoaded = !0;
          });
          this.videoAD.onError(function (e) {
            console.log("Video onError", JSON.stringify(e));

            if (t.videoCallback) {
              t.videoCallback(n.AdsCode.error);
              t.videoCallback = void 0;
            }
          });
          this.videoAD.onClose(function (o) {
            console.log("Video onClose", JSON.stringify(o));
            e.isVideoLoaded = !1;

            if (t.videoCallback) {
              t.videoCallback(n.AdsCode.cancel);
              t.videoCallback = void 0;
            }
          });
          this.videoAD.onCompleted(function (e) {
            console.log("Video onCompleted", JSON.stringify(e));
            t.videoCallback(n.AdsCode.finish);
            t.videoCallback = void 0;
          });
          this.videoAD.load();
          this.videoAD.show()["catch"](function () {
            e.videoAD.load().then(function () {
              return e.videoAD.show();
            })["catch"](function (e) {
              console.log("激励视频 广告显示失败", e);

              if (t.videoCallback) {
                t.videoCallback(n.AdsCode.error);
                t.videoCallback = void 0;
              }
            });
          });
        };

        t.prototype.canShowVideo = function () {
          return !0;
        };

        t.prototype.showVideo = function (e) {
          console.log("showVideo");
          this.videoCallback = e;
          this.initVideo();
        };

        return t;
      }(o.AdsBase);

      e.Ads = i;

      var a = function (e) {
        __extends(t, e);

        function t() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.st = 1;
          return t;
        }

        t.prototype.init = function () {};

        t.prototype.share = function (e) {
          console.log("Box4399 ShareClick");
          this.st++;
          gamebox.shareMessageToFriend({
            type: this.st % 2,
            success: function success() {
              console.log("share success");
              e && e(n.ShareCode.success);
            },
            fail: function fail() {
              console.log("share fail");
              e && e(n.ShareCode.fail);
            },
            complete: function complete() {
              console.log("share complete");
            }
          });
        };

        return t;
      }(o.ShareBase);

      e.Share = a;
    })(e.BOX4399 || (e.BOX4399 = {}));

    (function (e) {
      var t = function (t) {
        __extends(n, t);

        function n() {
          return null !== t && t.apply(this, arguments) || this;
        }

        n.prototype.init = function () {
          var t = document.createElement("script");
          t.setAttribute("type", "text/javascript");
          t.src = e.Sdk.sdk_script_url;
          document.body.appendChild(t);
          document.title = Config.Base.baseKeys.appName;
        };

        n.prototype.login = function () {
          h5api.login(function (e) {
            console.log("login:", JSON.stringify(e));
          });
        };

        n.prototype.isLogin = function () {
          return h5api.isLogin();
        };

        n.prototype.submitRanking = function (e) {
          h5api.submitRanking(e, function (e) {
            console.log("submitRanking:", JSON.stringify(e));
          });
        };

        n.prototype.showRanking = function () {
          h5api.showRanking();
        };

        n.sdk_script_url = "http://h.api.4399.com/h5mini-2.0/h5api-interface.php";
        return n;
      }(o.SdkBase);

      e.Sdk = t;

      var i = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {
          var e = this;
          setTimeout(function () {
            e.loadVideo();
          }, 500);
        };

        t.prototype.loadVideo = function () {
          var e = this,
              t = setInterval(function () {
            if (h5api) {
              clearInterval(t);
              h5api.canPlayAd(function (t) {
                console.log("canPlayAd", JSON.stringify(t));
                e.isVideoLoaded = t.canPlayAd;
                e.isVideoLoaded;
                console.log("Mgr.Inst.hasAds", l.Inst.hasAds);
              });
            }
          }, 100);
        };

        t.prototype.canShowVideo = function () {
          console.log("canShowVideo:" + this.isVideoLoaded);
          this.canShowVideo || this.loadVideo();
          return this.isVideoLoaded;
        };

        t.prototype.showVideo = function (e) {
          var t = this;
          h5api.playAd(function (o) {
            console.log("showVideo data:" + JSON.stringify(o));

            if (1e4 === o.code) {
              console.log("start video");
              cc.director.pause();
            } else if (10001 === o.code) {
              console.log("end video");
              cc.director.resume();
              t.loadVideo();
              e && e(n.AdsCode.finish);
            } else {
              cc.director.resume();
              t.loadVideo();
              console.log("error video");
              e && e(n.AdsCode.error);
            }
          });
        };

        return t;
      }(o.AdsBase);

      e.Ads = i;

      var a = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {};

        t.prototype.share = function (e) {
          h5api.share();
          e && e(n.ShareCode.success);
        };

        return t;
      }(o.ShareBase);

      e.Share = a;
    })(e.M4399 || (e.M4399 = {}));

    (function (e) {
      var i = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {};

        t.prototype.login = function () {
          console.log("login");
        };

        t.prototype.vibrate = function () {
          qg.vibrateShort({
            success: function success() {},
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        t.prototype.vibrateLong = function () {
          qg.vibrateLong({
            success: function success() {},
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        t.prototype.hasIcon = function () {
          return "true" == cc.sys.localStorage.getItem("HasIcon");
        };

        t.prototype.createIcon = function (e) {
          var t = this;
          qg.hasShortcutInstalled({
            success: function success(n) {
              0 == n ? qg.installShortcut({
                success: function success() {
                  setTimeout(function () {
                    t.checkHasIcon(e);
                  }, 100);
                },
                fail: function fail() {
                  e(!1);
                },
                complete: function complete() {}
              }) : e(!0);
            },
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        t.prototype.checkHasIcon = function (e) {
          qg.hasShortcutInstalled({
            success: function success(t) {
              if (0 == t) {
                e(!1);
                cc.sys.localStorage.setItem("HasIcon", "false");
                console.log("没有图标");
              } else {
                e(!0);
                cc.sys.localStorage.setItem("HasIcon", "true");
                console.log("已创建图标");
              }
            },
            fail: function fail() {},
            complete: function complete() {}
          });
        };

        t.prototype.quit = function () {
          console.log("quit");
          qg.exitApplication({
            success: function success() {
              console.log("exitApplication success");
            },
            fail: function fail() {
              console.log("exitApplication fail");
            },
            complete: function complete() {
              console.log("exitApplication complete");
            }
          });
        };

        return t;
      }(o.SdkBase);

      e.Sdk = i;

      var a = function (i) {
        __extends(a, i);

        function a() {
          var e = null !== i && i.apply(this, arguments) || this;
          e.nativeInsertPre = null;
          e.nativeDataArr = [];
          e.nativeTypeWeight = [6, 5, 0, 1, 3, 4, 2];
          e.curNative = null;
          e.firstGetNativeTime = 0;
          return e;
        }

        a.prototype.init = function () {
          this.initBanner();
          this.initInsert();
          this.initVideo();
        };

        a.prototype.loadNativePre = function () {
          console.log("xiaomi ads loadNativePre");

          if (!this.nativeInsertPre) {
            var e = this;
            cc.loader.loadRes("SDK/NativeInsert", function (t, n) {
              null == t ? e.nativeInsertPre = n : console.log("err", t);
            });
          }
        };

        a.prototype.initBanner = function () {
          var e = this,
              t = qg.getSystemInfoSync(),
              n = Math.floor(t.windowWidth),
              o = Math.floor(t.windowHeight);
          console.log("banner create");
          this.bannerAD = qg.createBannerAd({
            adUnitId: Config.XIAOMI.bannerId,
            style: {
              left: (n - 400) / 2,
              top: o - 225,
              width: 400,
              height: 225
            },
            adIntervals: 30
          });
          var i = (n - 400) / 4;
          this.bannerAD.style.left = i;
          this.bannerAD.onLoad(function () {
            console.log("banner onLoad");
          });
          this.bannerAD.onError(function (e) {
            console.log("banner onError:" + JSON.stringify(e));
          });
          this.bannerAD.onResize(function (t) {
            console.log("banner onResize:" + t.width + "," + t.height);
            e.bannerAD.style.left = .5 * (n - e.bannerAD.style.realWidth);
            e.bannerAD.style.top = o - e.bannerAD.style.realHeight;
          });
        };

        a.prototype.showBanner = function () {
          console.log("showBanner");
          l.Inst.isAdOpen && this.bannerAD && this.bannerAD.show().then(function () {
            console.log("showBanner success");
          })["catch"](function (e) {
            console.log("showBanner error:" + JSON.stringify(e));
          });
        };

        a.prototype.closeBanner = function () {
          if (this.bannerAD) {
            console.log("closeBanner");
            this.bannerAD.hide();
          }
        };

        a.prototype.initInsert = function () {
          console.log("initInsert");
          this.insertAD = qg.createInterstitialAd({
            adUnitId: Config.XIAOMI.insertId
          });
          this.insertAD.onLoad(function () {
            console.log("insert onLoad");
          });
          this.insertAD.onError(function (e) {
            console.log("insert error:" + JSON.stringify(e));
          });
          this.insertAD.onClose(function () {
            console.log("insert onClose");
          });
        };

        a.prototype.showInsert = function () {
          console.log("showInsert");
          var e = this;
          setTimeout(function () {
            e.insertAD ? e.insertAD.show() : console.log("no insertAd");
          }, 500);
        };

        a.prototype.initVideo = function () {
          console.log("initVideo");
          var e = this;
          this.videoAD = qg.createRewardedVideoAd({
            adUnitId: Config.XIAOMI.videoId
          });
          this.videoAD.onLoad(function () {
            e.isVideoLoaded = !0;
            console.log("videoAd onLoad");
          });
          this.videoAD.onError(function (t) {
            e.isVideoLoaded = !1;
            console.log("onError", JSON.stringify(t));
            e.videoCallback && e.videoCallback(n.AdsCode.error);
          });
          this.videoAD.onClose(function (t) {
            console.log("video_onClose func+", JSON.stringify(t), JSON.stringify(e.videoCallback));
            e.isVideoLoaded = !1;
            if (e.videoCallback) if (t && t.isEnded) {
              e.videoCallback(n.AdsCode.finish);
              console.log("isEnded");
            } else {
              e.videoCallback(n.AdsCode.cancel);
              console.log("cancel");
            }
          });
        };

        a.prototype.canShowVideo = function () {
          console.log("Video:" + this.isVideoLoaded);
          !this.isVideoLoaded && this.videoAD && this.videoAD.load();
          return this.isVideoLoaded;
        };

        a.prototype.showVideo = function (e) {
          console.log("showVideo:fun", JSON.stringify(e));
          this.videoCallback = e;

          if (this.isVideoLoaded) {
            if (this.videoAD) {
              console.log("show");
              this.videoAD.show();
            } else console.log("no Video");
          } else {
            console.log("not isVideoLoaded");
            this.videoCallback(n.AdsCode.error);
            this.videoAD.load();
          }
        };

        a.prototype.initNative = function () {
          console.log("initNative");
          var n = this,
              i = null;

          if (qg.createNativeAd) {
            i = qg.createNativeAd({
              adUnitId: Config.XIAOMI.nativeId
            });
            setTimeout(function () {
              i.load();
            }, 500);
            setInterval(function () {
              if (n.nativeDataArr.length < 3) i.load();else {
                console.log("native full ");

                if (n.nativeDataArr[2].weight >= 3) {
                  var e = n.nativeDataArr.pop();
                  console.log("remove native", JSON.stringify(e));
                  i.load();
                }
              }
            }, 1e4);
            setInterval(function () {
              n.freshNative();
            }, 1e3 * t.Mgr.Inst.nativeFreshTime);

            var a = function a(e, t) {
              var n = e.weight,
                  o = t.weight;
              return n < o ? -1 : n > o ? 1 : 0;
            };

            i.onLoad(function (t) {
              console.log("native onLoad");
              t.adList.forEach(function (t) {
                var o = new e.Native();
                o.ad = i;
                o.adId = t.adId;
                o.title = t.title;
                o.desc = t.desc;
                o.iconUrl = t.icon;
                o.imgUrl = t.imgUrlList[0];
                o.clickBtnTxt = t.clickBtnTxt;
                o.interactionType = t.interactionType;
                o.weight = n.nativeTypeWeight[t.interactionType];
                n.nativeDataArr.push(o);
                n.nativeDataArr.sort(a);
                n.curNative || (n.curNative = o);
              });
              o.Event.emit("onGetNativeAd");
            });
            i.onError(function (e) {
              e && console.log("native onError", JSON.stringify(e));
            });
          } else console.log("### qg.createNativeAd is not a function");
        };

        a.prototype.hasNative = function () {
          return !(l.Inst.gameTime < l.Inst.adProtectTime) && null != this.curNative;
        };

        a.prototype.getNative = function () {
          return this.curNative;
        };

        a.prototype.freshNative = function () {
          this.nativeDataArr.length > 0 && (this.curNative = this.nativeDataArr.splice(0, 1)[0]);
        };

        a.prototype.clickNative = function () {
          console.log("点击原生广告，当前原生广告置空");
        };

        a.prototype.canShowNativeInsert = function () {
          return this.hasNative();
        };

        a.prototype.showNativeInsert = function (e) {
          var t = this.getNative();

          if (t) {
            this.createNative(t);
            this.closeBanner();
          } else if (e) {
            e(n.AdsCode.error);
            e = null;
          }
        };

        a.prototype.createNative = function (e) {
          var t = cc.instantiate(this.nativeInsertPre);
          t.getComponent("NativeInsertAd").showInsert(e, !0);
          cc.director.getScene().getChildByName("Canvas").addChild(t);
        };

        return a;
      }(o.AdsBase);

      e.Ads = a;

      var r = function (e) {
        __extends(t, e);

        function t() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.ad = null;
          t.adId = "";
          t.hasShow = !1;
          return t;
        }

        t.prototype.show = function () {
          if (this.hasShow) console.log("原生广告已展示，不再重复展示", this.adId);else {
            this.hasShow = !0;
            console.log("原生广告展示", this.adId);
            this.ad.reportAdShow({
              adId: this.adId
            });
          }
        };

        t.prototype.click = function () {
          this.ad.reportAdClick({
            adId: this.adId
          });
          l.Inst.customData && "false" == l.Inst.customData.nativeNotFresh && o.Event.emit("onFreshNativeAdData", this.adId);
        };

        return t;
      }(o.NativeBase);

      e.Native = r;
    })(e.XIAOMI || (e.XIAOMI = {}));

    (function (e) {
      var t = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {
          this.login();
        };

        t.prototype.login = function () {
          var e = document.createElement("script");
          e.setAttribute("type", "text/javascript");
          e.src = t.sdk_script_url;
          document.body.appendChild(e);
          var n = document.createElement("meta");
          n.name = "app_id";
          n.content = Config.QTT.appId;
          document.getElementsByTagName("head")[0].appendChild(n);
          document.title = Config.Base.baseKeys.appName;
        };

        t.sdk_script_url = "//newidea4-gamecenter-frontend.1sapp.com/sdk/prod/h5.v1.0.0.js?spread=required";
        return t;
      }(o.SdkBase);

      e.Sdk = t;

      var i = function (e) {
        __extends(t, e);

        function t() {
          return null !== e && e.apply(this, arguments) || this;
        }

        t.prototype.init = function () {};

        t.prototype.showBanner = function () {
          console.log("banner show");
          qttGame ? qttGame.showBanner() : console.log("banner null");
        };

        t.prototype.closeBanner = function () {
          console.log("banner close");
          qttGame ? qttGame.hideBanner() : console.log("banner null");
        };

        t.prototype.canShowInsert = function () {
          console.log("insert is :" + qttGame);
          return qttGame;
        };

        t.prototype.showInsert = function (e) {
          console.log("insert show");
          var t = {};
          t.gametype = Math.floor(3 * Math.random()) + 1;
          t.rewardtype = 1;
          t.data = {};
          t.data.title = "奖励";

          t.callback = function (t) {
            1 == t ? e && e(n.AdsCode.finish) : 0 == t ? e && e(n.AdsCode.error) : 2 == t && e && e(n.AdsCode.cancel);
          };

          qttGame.showHDAD(t);
        };

        t.prototype.canShowVideo = function () {
          console.log("video is " + qttGame);
          return qttGame;
        };

        t.prototype.showVideo = function (e) {
          console.log("video show");

          if (qttGame) {
            var t = {};
            t.gametype = Math.floor(3 * Math.random()) + 1;
            t.rewardtype = 1;
            t.data = {};
            t.data.title = "奖励";
            qttGame.showVideo(function (t) {
              1 == t ? e && e(n.AdsCode.finish) : 0 == t ? e && e(n.AdsCode.error) : 2 == t && e && e(n.AdsCode.cancel);
            }, t);
          } else {
            console.log("视频不可用");
            e && e(n.AdsCode.error);
          }
        };

        return t;
      }(o.AdsBase);

      e.Ads = i;
    })(e.QTT || (e.QTT = {}));
  })(i = t.Mini || (t.Mini = {}));

  (function (e) {
    window.AndroidCallback = function (e, t) {
      console.log("AndroidCallback: " + e + " | " + t);
      if ("Banner" == e) ;else if ("Insert" == e) {
        if ("Close" == t && l.Inst.getAds().insertCallback) {
          l.Inst.getAds().insertCallback(n.AdsCode.finish);
          l.Inst.getAds().insertCallback = null;
        }
      } else "Video" == e && setTimeout(function () {
        if ("Complete" == t) {
          if (l.Inst.getAds().videoCallback) {
            l.Inst.getAds().videoCallback(n.AdsCode.finish);
            l.Inst.getAds().videoCallback = null;
          }
        } else if ("Close" == t && l.Inst.getAds().videoCallback) {
          l.Inst.getAds().videoCallback(n.AdsCode.cancel);
          l.Inst.getAds().videoCallback = null;
        }
      }, 100);
    };

    var t = function () {
      function e() {
        this.bridgeClass = "com.util.Bridge";
      }

      Object.defineProperty(e, "Inst", {
        get: function get() {
          null == e._INST && (e._INST = new e());
          return e._INST;
        },
        enumerable: !1,
        configurable: !0
      });

      e.prototype.callFunction = function (e) {
        this.Call("CallFunction", "(Ljava/lang/String;)V", e);
      };

      e.prototype.callFunctionWithParam = function (e, t) {
        this.Call("CallFunctionWithParam", "(Ljava/lang/String;Ljava/lang/String;)V", e, t);
      };

      e.prototype.callFunctionForBool = function (e) {
        return "true" == this.CallForValue("CallFunctionForValue", "(Ljava/lang/String;)Ljava/lang/String;", e);
      };

      e.prototype.callFunctionForValue = function (e) {
        return this.CallForValue("CallFunctionForValue", "(Ljava/lang/String;)Ljava/lang/String;", e);
      };

      e.prototype.Call = function (e, t) {
        for (var n, o = [], i = 2; i < arguments.length; i++) {
          o[i - 2] = arguments[i];
        }

        var a = this.bridgeClass;
        "undefined" != typeof jsb ? (n = jsb.reflection).callStaticMethod.apply(n, __spreadArrays([a, e, t], o)) : console.log("jsb 为空");
      };

      e.prototype.CallForValue = function (e, t) {
        for (var n, o = [], i = 2; i < arguments.length; i++) {
          o[i - 2] = arguments[i];
        }

        var a = this.bridgeClass;

        if ("undefined" != typeof jsb) {
          var r = (n = jsb.reflection).callStaticMethod.apply(n, __spreadArrays([a, e, t], o));
          return r;
        }

        console.log("jsb 为空");
        return "";
      };

      return e;
    }();

    e.Bridge = t;

    (function (e) {
      var i = function (e) {
        __extends(n, e);

        function n() {
          return null !== e && e.apply(this, arguments) || this;
        }

        n.prototype.init = function () {};

        n.prototype.login = function () {};

        n.prototype.jump = function () {
          t.Inst.callFunction("Jump");
        };

        n.prototype.rate = function () {
          t.Inst.callFunction("Rate");
        };

        n.prototype.pay = function (e) {
          t.Inst.callFunctionWithParam("Pay", e.toString());
        };

        n.prototype.quit = function () {
          t.Inst.callFunction("Quit");
        };

        n.prototype.vibrate = function () {
          t.Inst.callFunction("Vibrate");
        };

        n.prototype.vibrateLong = function () {
          t.Inst.callFunction("VibrateLong");
        };

        n.prototype.openUrl = function (e) {
          t.Inst.callFunctionWithParam("OpenUrl", e);
        };

        n.prototype.privacy = function () {
          cc.sys.openURL("https://qgame.996joy.com/game/web/oppo/privacy.html");
        };

        n.prototype.agreement = function () {
          cc.sys.openURL("https://qgame.996joy.com/game/web/oppo/agreement.html");
        };

        return n;
      }(o.SdkBase);

      e.Sdk = i;

      var a = function (e) {
        __extends(o, e);

        function o() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.curNative = null;
          t.firstGetNativeTime = 0;
          t.closeNativeTime = 0;
          t.nativeInsertPre = null;
          return t;
        }

        o.prototype.init = function () {
          t.Inst.callFunction("Init");
          this.loadNativePre();
        };

        o.prototype.reInit = function () {
          this.init();
        };

        o.prototype.loadNativePre = function () {
          if (!this.nativeInsertPre) {
            var e = this;
            cc.loader.loadRes("SDK/NativeInsert", function (t, n) {
              null == t ? e.nativeInsertPre = n : console.log("err", t);
            });
          }
        };

        o.prototype.showBanner = function () {
          console.log("废弃Banner");
        };

        o.prototype.closeBanner = function () {};

        o.prototype.canShowInsert = function () {
          return this.hasNative();
        };

        o.prototype.showInsert = function (e) {
          this.insertCallback = e;
          this.hasNative() && this.showNativeInsert(this.insertCallback);
        };

        o.prototype.closeInsert = function () {};

        o.prototype.canShowInsertNormal = function () {
          return t.Inst.callFunctionForBool("IsInsertNormalEnable");
        };

        o.prototype.showInsertNormal = function (e) {
          this.insertCallback = e;
          t.Inst.callFunction("ShowInsertNormal");
        };

        o.prototype.canShowVideo = function () {
          return t.Inst.callFunctionForBool("IsVideoEnable");
        };

        o.prototype.showVideo = function (e) {
          this.videoCallback = e;
          t.Inst.callFunction("ShowVideo");
        };

        o.prototype.hasNative = function () {
          return (t.Inst.callFunctionForBool("IsNativeEnable") || null != this.curNative) && (this.closeNativeTime < 5 || l.Inst.isAdOpen);
        };

        o.prototype.closeNative = function () {
          this.closeNativeTime++;
          console.log("关闭原生广告次数", this.closeNativeTime);
        };

        o.prototype.getNative = function () {
          if (this.closeNativeTime >= 5 && !l.Inst.isAdOpen) {
            console.log("关闭原生广告次数达到上限", this.closeNativeTime);
            return null;
          }

          if (!this.curNative || c.Helper.getCurTimeSecends() - this.firstGetNativeTime >= l.Inst.nativeFreshTime) {
            this.curNative ? console.log("原生广告过期:", c.Helper.getCurTimeSecends() - this.firstGetNativeTime) : console.log("首次获取原生广告");

            if (t.Inst.callFunctionForBool("IsNativeEnable")) {
              var e = t.Inst.callFunctionForValue("GetNativeData").split("|");
              this.curNative = new r();
              this.curNative.adId = e[0];
              this.curNative.title = e[1];
              this.curNative.desc = e[2];
              this.curNative.iconUrl = e[3];
              this.curNative.imgUrl = e[4];
              this.curNative.logoUrl = e[5];
              this.curNative.btnText = e[6];
              this.firstGetNativeTime = c.Helper.getCurTimeSecends();
            } else console.log("未获取到原生广告");
          }

          return this.curNative;
        };

        o.prototype.clickNative = function () {
          console.log("点击原生广告，当前原生广告置空");
          this.curNative = null;
        };

        o.prototype.showNativeInsert = function (e) {
          var t = this.getNative();

          if (t) {
            this.createNative(t);
            this.closeBanner();
          } else if (e) {
            e(n.AdsCode.error);
            e = null;
          }
        };

        o.prototype.createNative = function (e) {
          var t = cc.instantiate(this.nativeInsertPre);
          t.getComponent("NativeInsertAd").showInsert(e, !0);
          cc.director.getScene().getChildByName("Canvas").addChild(t);
        };

        return o;
      }(o.AdsBase);

      e.Ads = a;

      var r = function (e) {
        __extends(n, e);

        function n() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.adId = "";
          t.logoUrl = "";
          t.btnText = "";
          t.hasShow = !1;
          return t;
        }

        n.prototype.show = function () {
          if (this.hasShow) console.log("原生广告已展示，不再重复展示", this.adId);else {
            this.hasShow = !0;
            console.log("原生广告展示", this.adId);
            t.Inst.callFunctionWithParam("ShowNative", this.adId);
          }
        };

        n.prototype.click = function () {
          t.Inst.callFunctionWithParam("ClickNative", this.adId);
          o.Event.emit("onFreshNativeAdData", this.adId);
        };

        n.prototype.close = function () {};

        return n;
      }(o.NativeBase);

      e.Native = r;
    })(e.OPPO || (e.OPPO = {}));

    (function (e) {
      var i = function (e) {
        __extends(n, e);

        function n() {
          return null !== e && e.apply(this, arguments) || this;
        }

        n.prototype.init = function () {};

        n.prototype.login = function () {};

        n.prototype.quit = function () {
          t.Inst.callFunction("Quit");
        };

        n.prototype.openUrl = function (e) {
          t.Inst.callFunctionWithParam("OpenUrl", e);
        };

        n.prototype.vibrate = function () {
          t.Inst.callFunction("Vibrate");
        };

        n.prototype.vibrateLong = function () {
          t.Inst.callFunction("VibrateLong");
        };

        n.prototype.privacy = function () {
          cc.sys.openURL("https://qgame.996joy.com/game/web/vivo/privacy.html");
        };

        n.prototype.agreement = function () {
          cc.sys.openURL("https://qgame.996joy.com/game/web/vivo/agreement.html");
        };

        return n;
      }(o.SdkBase);

      e.Sdk = i;

      var a = function (e) {
        __extends(o, e);

        function o() {
          return null !== e && e.apply(this, arguments) || this;
        }

        o.prototype.init = function () {
          t.Inst.callFunction("Init");
        };

        o.prototype.showBanner = function () {
          t.Inst.callFunction("ShowBanner");
        };

        o.prototype.closeBanner = function () {
          t.Inst.callFunction("CloseBanner");
        };

        o.prototype.canShowIcon = function () {
          return t.Inst.callFunctionForBool("IsIconEnable");
        };

        o.prototype.showIcon = function () {
          t.Inst.callFunction("ShowIcon");
        };

        o.prototype.canShowInsert = function () {
          return t.Inst.callFunctionForBool("IsInsertEnable");
        };

        o.prototype.showInsert = function (e) {
          this.insertCallback = e;
          if (this.canShowInsert()) t.Inst.callFunction("ShowInsert");else if (this.insertCallback) {
            this.insertCallback(n.AdsCode.error);
            this.insertCallback = null;
          }
        };

        o.prototype.closeInsert = function () {
          t.Inst.callFunction("CloseInsert");
        };

        o.prototype.canShowVideo = function () {
          return t.Inst.callFunctionForBool("IsVideoEnable");
        };

        o.prototype.showVideo = function (e) {
          this.videoCallback = e;
          if (this.canShowVideo()) t.Inst.callFunction("ShowVideo");else if (this.videoCallback) {
            this.videoCallback(n.AdsCode.error);
            this.videoCallback = null;
          }
        };

        return o;
      }(o.AdsBase);

      e.Ads = a;
    })(e.VIVO || (e.VIVO = {}));

    (function (e) {
      var n = function (e) {
        __extends(n, e);

        function n() {
          return null !== e && e.apply(this, arguments) || this;
        }

        n.prototype.init = function () {};

        n.prototype.login = function () {};

        n.prototype.jump = function () {
          t.Inst.callFunction("Jump");
        };

        n.prototype.pay = function (e) {
          t.Inst.callFunctionWithParam("Pay", e.toString());
        };

        n.prototype.quit = function () {
          t.Inst.callFunction("Quit");
        };

        n.prototype.vibrate = function () {
          t.Inst.callFunction("Vibrate");
        };

        n.prototype.vibrateLong = function () {
          t.Inst.callFunction("VibrateLong");
        };

        n.prototype.openUrl = function (e) {
          t.Inst.callFunctionWithParam("OpenUrl", e);
        };

        n.prototype.privacy = function () {
          this.openUrl("file:///android_asset/privacy.html");
        };

        n.prototype.agreement = function () {
          this.openUrl("file:///android_asset/agreement.html");
        };

        return n;
      }(o.SdkBase);

      e.Sdk = n;

      var i = function (e) {
        __extends(n, e);

        function n() {
          return null !== e && e.apply(this, arguments) || this;
        }

        n.prototype.init = function () {
          t.Inst.callFunction("Init");
        };

        n.prototype.showBanner = function () {
          t.Inst.callFunction("ShowBanner");
        };

        n.prototype.closeBanner = function () {
          t.Inst.callFunction("CloseBanner");
        };

        n.prototype.canShowInsert = function () {
          return t.Inst.callFunctionForBool("IsInsertEnable");
        };

        n.prototype.showInsert = function (e) {
          this.insertCallback = e;
          t.Inst.callFunction("ShowInsert");
        };

        n.prototype.closeInsert = function () {
          t.Inst.callFunction("CloseInsert");
        };

        n.prototype.canShowVideo = function () {
          return t.Inst.callFunctionForBool("IsVideoEnable");
        };

        n.prototype.showVideo = function (e) {
          this.videoCallback = e;
          t.Inst.callFunction("ShowVideo");
        };

        return n;
      }(o.AdsBase);

      e.Ads = i;
    })(e.M4399 || (e.M4399 = {}));

    (function (e) {
      var n = function (e) {
        __extends(n, e);

        function n() {
          return null !== e && e.apply(this, arguments) || this;
        }

        n.prototype.quit = function () {
          t.Inst.callFunction("Quit");
        };

        n.prototype.openUrl = function (e) {
          t.Inst.callFunctionWithParam("OpenUrl", e);
        };

        n.prototype.vibrate = function () {
          t.Inst.callFunction("Vibrate");
        };

        n.prototype.vibrateLong = function () {
          t.Inst.callFunction("VibrateLong");
        };

        n.prototype.privacy = function () {
          this.openUrl("file:///android_asset/privacy.html");
        };

        n.prototype.agreement = function () {
          this.openUrl("file:///android_asset/agreement.html");
        };

        return n;
      }(o.SdkBase);

      e.Sdk = n;

      var i = function (e) {
        __extends(n, e);

        function n() {
          return null !== e && e.apply(this, arguments) || this;
        }

        n.prototype.init = function () {
          t.Inst.callFunction("Init");
        };

        n.prototype.showBanner = function () {
          t.Inst.callFunction("ShowBanner");
        };

        n.prototype.closeBanner = function () {
          t.Inst.callFunction("CloseBanner");
        };

        n.prototype.canShowInsert = function () {
          return t.Inst.callFunctionForBool("IsInsertEnable");
        };

        n.prototype.showInsert = function (e) {
          this.insertCallback = e;
          t.Inst.callFunction("ShowInsert");
        };

        n.prototype.closeInsert = function () {
          t.Inst.callFunction("CloseInsert");
        };

        n.prototype.canShowVideo = function () {
          return t.Inst.callFunctionForBool("IsVideoEnable");
        };

        n.prototype.showVideo = function (e) {
          this.videoCallback = e;
          t.Inst.callFunction("ShowVideo");
        };

        return n;
      }(o.AdsBase);

      e.Ads = i;
    })(e.TT || (e.TT = {}));

    (function (e) {
      var n = function (e) {
        __extends(n, e);

        function n() {
          return null !== e && e.apply(this, arguments) || this;
        }

        n.prototype.quit = function () {
          t.Inst.callFunction("Quit");
        };

        n.prototype.openUrl = function (e) {
          t.Inst.callFunctionWithParam("OpenUrl", e);
        };

        n.prototype.privacy = function () {
          this.openUrl("file:///android_asset/privacy.html");
        };

        n.prototype.agreement = function () {
          this.openUrl("file:///android_asset/agreement.html");
        };

        return n;
      }(o.SdkBase);

      e.Sdk = n;

      var i = function (e) {
        __extends(n, e);

        function n() {
          var t = null !== e && e.apply(this, arguments) || this;
          t.showInsertTime = 0;
          return t;
        }

        n.prototype.init = function () {
          t.Inst.callFunction("Init");
        };

        n.prototype.canShowInsert = function () {
          return t.Inst.callFunctionForBool("IsInsertVideoEnable");
        };

        n.prototype.showInsert = function (e) {
          if (l.Inst.isAdOpen || c.Helper.getCurTimeSecends() - this.showInsertTime >= 60) {
            this.showInsertTime = c.Helper.getCurTimeSecends();
            this.insertCallback = e;
            t.Inst.callFunction("ShowInsertVideo");
          } else console.log("插屏间隔时间过短:", c.Helper.getCurTimeSecends() - this.showInsertTime);
        };

        n.prototype.canShowVideo = function () {
          return t.Inst.callFunctionForBool("IsVideoEnable");
        };

        n.prototype.showVideo = function (e) {
          this.videoCallback = e;
          t.Inst.callFunction("ShowVideo");
        };

        return n;
      }(o.AdsBase);

      e.Ads = i;
    })(e.M233 || (e.M233 = {}));
  })(a = t.Android || (t.Android = {}));

  (function (e) {
    window.IosCallback = function (e, t) {
      console.log("IosCallback: " + e + " | " + t);
      if ("Banner" == e) ;else if ("Insert" == e) ;else if ("InsertVideo" == e) {
        if ("Show" == t) {
          cc.director.pause();
          l.Inst.pauseMusic();
        } else if ("Close" == t) {
          cc.director.resume();
          l.Inst.resumeMusic();
        }
      } else if ("Video" == e) {
        if ("Show" == t) {
          cc.director.pause();
          l.Inst.pauseMusic();
        } else if ("Complete" == t) {
          if (l.Inst.getAds().videoCallback) {
            l.Inst.getAds().videoCallback(n.AdsCode.finish);
            l.Inst.getAds().videoCallback = null;
          }
        } else if ("Close" == t) {
          cc.director.resume();
          l.Inst.resumeMusic();

          if (l.Inst.getAds().videoCallback) {
            l.Inst.getAds().videoCallback(n.AdsCode.cancel);
            l.Inst.getAds().videoCallback = null;
          }
        }
      } else if ("Splash" == e) if ("Show" == t) {
        cc.director.pause();
        l.Inst.pauseMusic();
      } else if ("Close" == t) {
        cc.director.resume();
        l.Inst.resumeMusic();
      }
    };

    var t = function () {
      function e() {
        this.bridgeClass = "SDKOC";
      }

      Object.defineProperty(e, "Inst", {
        get: function get() {
          null == e._INST && (e._INST = new e());
          return e._INST;
        },
        enumerable: !1,
        configurable: !0
      });

      e.prototype.call = function (e, t) {
        if ("undefined" != typeof jsb) {
          t || (t = "");
          return jsb.reflection.callStaticMethod(this.bridgeClass, "callFunction:WithParam:", e, t);
        }

        console.log("jsb 为空");
        return "";
      };

      return e;
    }();

    e.Bridge = t;

    var i = function (e) {
      __extends(n, e);

      function n() {
        return null !== e && e.apply(this, arguments) || this;
      }

      n.prototype.rate = function () {
        t.Inst.call("Rate", Config.IOS.appleId);
      };

      n.prototype.promo = function (e, n) {
        t.Inst.call("Promo", e.param);
        n && n(!0);
      };

      n.prototype.vibrate = function () {
        t.Inst.call("Vibrate");
      };

      n.prototype.vibrateLong = function () {
        t.Inst.call("VibrateLong");
      };

      return n;
    }(o.SdkBase);

    e.Sdk = i;

    var a = function (e) {
      __extends(n, e);

      function n() {
        return null !== e && e.apply(this, arguments) || this;
      }

      n.prototype.showBanner = function () {
        t.Inst.call("ShowBanner");
      };

      n.prototype.closeBanner = function () {
        t.Inst.call("CloseBanner");
      };

      n.prototype.canShowInsert = function () {
        return "true" == t.Inst.call("IsInsertVideoEnable");
      };

      n.prototype.showInsert = function (e) {
        this.insertCallback = e;
        t.Inst.call("ShowInsertVideo");
      };

      n.prototype.canShowVideo = function () {
        return "true" == t.Inst.call("IsVideoEnable");
      };

      n.prototype.showVideo = function (e) {
        this.videoCallback = e;
        t.Inst.call("ShowVideo");
      };

      return n;
    }(o.AdsBase);

    e.Ads = a;
  })(r = t.Ios || (t.Ios = {}));

  (function (t) {
    var o = function () {
      function t() {
        this.hasInit = !1;
        this.uma = null;
      }

      Object.defineProperty(t, "Inst", {
        get: function get() {
          null == t._INST && (t._INST = new t());
          return t._INST;
        },
        enumerable: !1,
        configurable: !0
      });

      t.prototype.init = function (t, o) {
        void 0 === o && (o = "default");
        cc.sys.platform == cc.sys.OPPO_GAME || cc.sys.platform == cc.sys.VIVO_GAME || cc.sys.platform == cc.sys.HUAWEI_GAME || cc.sys.platform == cc.sys.XIAOMI_GAME ? this.uma = e("uma_qg") : cc.sys.platform == cc.sys.BYTEDANCE_GAME ? this.uma = e("uma_tt") : cc.sys.platform == cc.sys.WECHAT_GAME && (o == n.Channel.wx ? this.uma = e("uma_wx") : o == n.Channel.qq && (this.uma = e("uma_qq")));
        this.uma && (cc.sys.platform == cc.sys.OPPO_GAME || cc.sys.platform == cc.sys.VIVO_GAME || cc.sys.platform == cc.sys.HUAWEI_GAME || cc.sys.platform == cc.sys.XIAOMI_GAME ? this.uma.init({
          appKey: t,
          useOpenid: !1,
          debug: !1
        }) : cc.sys.platform != cc.sys.BYTEDANCE_GAME && cc.sys.platform != cc.sys.WECHAT_GAME || this.uma.init({
          appKey: t,
          autoGetOpenid: !0,
          debug: !1,
          uploadUserInfo: !0
        }));
        this.hasInit = !0;
      };

      t.prototype.event = function (e, t) {
        this.hasInit && this.uma && (t ? this.uma.trackEvent(e, JSON.stringify(t)) : this.uma.trackEvent(e));
      };

      t.prototype.levelStart = function (e) {
        this.hasInit && this.uma && this.uma.stage.onStart({
          stageId: "stage" + e,
          stageName: "第" + e + "关"
        });
      };

      t.prototype.levelFinish = function (e) {
        this.hasInit && this.uma && this.uma.stage.onEnd({
          stageId: "stage" + e,
          stageName: "第" + e + "关",
          event: "complete"
        });
      };

      t.prototype.levelFail = function (e) {
        this.hasInit && this.uma && this.uma.stage.onEnd({
          stageId: "stage" + e,
          stageName: "第" + e + "关",
          event: "fail"
        });
      };

      return t;
    }();

    t.UmaSdk = o;

    var i = function () {
      function e() {
        this.hasInit = !1;
        this.appId = "";
        this.channel = "";
        this.deviceid = "";
        this.url = "https://log.reyun.com/receive/rest/";
      }

      Object.defineProperty(e, "Inst", {
        get: function get() {
          null == e._INST && (e._INST = new e());
          return e._INST;
        },
        enumerable: !1,
        configurable: !0
      });

      e.prototype.init = function (e, t) {
        var n = this;
        void 0 === t && (t = "default");
        this.appId = e;
        this.channel = t;
        var o = "ReYunDeviceID";
        d.hasKey(o) || d.setValue(o, new Date().getTime().toString(16));
        this.deviceid = d.getValue(o);
        this.install();
        this.startup();
        setInterval(function () {
          return n.heartbeat();
        }, 3e5);
        this.hasInit = !0;
      };

      e.prototype.event = function (e) {
        if (this.hasInit) {
          var t = {},
              n = {};
          n.deviceid = this.deviceid;
          n.channelid = this.channel;
          t.appid = this.appId;
          t.context = n;
          t.who = this.deviceid;
          t.what = e;
          this.request("event", t);
        }
      };

      e.prototype.request = function (e, t) {
        new c.WWW(this.url + e, t).Send("post", "json");
      };

      e.prototype.install = function () {
        var e = {},
            t = {};
        t.deviceid = this.deviceid;
        t.channelid = this.channel;
        e.appid = this.appId;
        e.context = t; // this.request("install", e)
      };

      e.prototype.startup = function () {
        var e = {},
            t = {};
        t.deviceid = this.deviceid;
        t.channelid = this.channel;
        e.appid = this.appId;
        e.context = t; // this.request("startup", e)
      };

      e.prototype.register = function () {
        var e = {},
            t = {};
        t.deviceid = this.deviceid;
        t.channelid = this.channel;
        e.appid = this.appId;
        e.context = t;
        e.who = this.deviceid;
        this.request("register", e);
      };

      e.prototype.heartbeat = function () {
        var e = {},
            t = {};
        t.deviceid = this.deviceid;
        t.channelid = this.channel;
        e.appid = this.appId;
        e.context = t;
        e.who = this.deviceid;
        this.request("heartbeat", e);
      };

      return e;
    }();

    t.RYSdk = i;

    var s = function () {
      function e() {
        this.hasInit = !1;
      }

      Object.defineProperty(e, "Inst", {
        get: function get() {
          null == e._INST && (e._INST = new e());
          return e._INST;
        },
        enumerable: !1,
        configurable: !0
      });

      e.prototype.init = function (e, t) {
        void 0 === t && (t = "default");

        if (!this.hasInit) {
          this.hasInit = !0;
          cc.sys.platform == cc.sys.ANDROID && a.Bridge.Inst.callFunctionWithParam("umengInit", e + "|" + t);
        }
      };

      e.prototype.event = function (e) {
        this.hasInit && (cc.sys.platform == cc.sys.ANDROID ? a.Bridge.Inst.callFunctionWithParam("umengEvent", e) : cc.sys.platform != cc.sys.IPHONE && cc.sys.platform != cc.sys.IPAD || r.Bridge.Inst.call("Event", e));
      };

      e.prototype.levelStart = function (e) {
        this.hasInit && (cc.sys.platform == cc.sys.ANDROID ? a.Bridge.Inst.callFunctionWithParam("umengLevelStart", e) : cc.sys.platform != cc.sys.IPHONE && cc.sys.platform != cc.sys.IPAD || r.Bridge.Inst.call("LevelStart", e));
      };

      e.prototype.levelFinish = function (e) {
        this.hasInit && (cc.sys.platform == cc.sys.ANDROID ? a.Bridge.Inst.callFunctionWithParam("umengLevelFinish", e) : cc.sys.platform != cc.sys.IPHONE && cc.sys.platform != cc.sys.IPAD || r.Bridge.Inst.call("LevelFinish", e));
      };

      e.prototype.levelFail = function (e) {
        this.hasInit && (cc.sys.platform == cc.sys.ANDROID ? a.Bridge.Inst.callFunctionWithParam("umengLevelFail", e) : cc.sys.platform != cc.sys.IPHONE && cc.sys.platform != cc.sys.IPAD || r.Bridge.Inst.call("LevelFail", e));
      };

      return e;
    }();

    t.UmengSdk = s;
  })(s = t.Analytics || (t.Analytics = {}));

  (function (e) {
    var t = function () {
      function e(e, t) {
        var n = this;
        void 0 === t && (t = null);
        this._form = null;
        this._url = null;
        this._promise = null;
        this._resolve = null;
        this._error = null;
        this._text = null;
        this.logError = !0;
        this.logText = !1;
        this._url = e;
        this._form = t;
        this._promise = new Promise(function (e) {
          n._resolve = e;
        });
      }

      Object.defineProperty(e.prototype, "error", {
        get: function get() {
          return this._error;
        },
        enumerable: !1,
        configurable: !0
      });

      e.prototype.LogError = function () {
        this.logError && null != this.error && console.log("error -> " + this.error);
      };

      Object.defineProperty(e.prototype, "text", {
        get: function get() {
          return this._text;
        },
        enumerable: !1,
        configurable: !0
      });

      e.prototype.LogText = function () {
        this.logText && null != this.text && console.log("text -> " + this.text);
      };

      e.prototype.Send = function (e, t) {
        var n = this;
        void 0 === e && (e = null);
        void 0 === t && (t = null);
        null == e && (e = "get");
        var o = this._url,
            i = null;

        switch (t) {
          case "form":
            for (var a = Object.keys(this._form), r = 0; r < a.length; r++) {
              var s = a[r];
              0 == r ? i = s + "=" + this._form[s] : i += "&" + s + "=" + this._form[s];
            }

            break;

          case "json":
            i = JSON.stringify(this._form);
        }

        switch (e) {
          case "get":
            null != i && (o += "?" + i);
        }

        var c = new XMLHttpRequest();

        c.onreadystatechange = function () {
          if (4 == c.readyState) {
            200 == c.status ? n._text = c.responseText : n._error = c.status + " - " + c.responseText;

            n._resolve();

            n.LogError();
            n.LogText();
          }
        };

        c.open(e, o, !0);
        c.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

        switch (e) {
          case "get":
            c.send();
            break;

          case "post":
            c.send(i);
        }

        return this._promise;
      };

      return e;
    }();

    e.WWW = t;

    var n = function () {
      function e() {}

      e.formatTimeFull = function (e) {
        var t = Math.floor(e / 3600),
            n = Math.floor((e - 3600 * t) / 60),
            o = e - 3600 * t - 60 * n;
        return t.toString() + ":" + ("0" + n).substr(-2) + ":" + ("0" + o).substr(-2);
      };

      e.formatTimeFull_M = function (e) {
        var t = Math.floor(e / 60),
            n = Math.floor(e - 60 * t),
            o = Math.floor(100 * (e - Math.floor(e)));
        return ("0" + t).substr(-2) + ":" + ("0" + n).substr(-2) + ":" + ("0" + o).substr(-2);
      };

      e.formatTimeFullShort = function (e) {
        var t = Math.floor(e / 60),
            n = e - 60 * t;
        return ("0" + t).substr(-2) + ":" + ("0" + n).substr(-2);
      };

      e.getCurTimeSecends = function () {
        var e = new Date();
        return Math.floor(e.getTime() / 1e3);
      };

      e.getTodayDate = function () {
        var e = new Date();
        e.setTime(e.getTime());
        return e.getFullYear() + "-" + (e.getMonth() + 1) + "-" + e.getDate();
      };

      e.lerp = function (e, t, n) {
        return e + (t - e) * ((n = n < 0 ? 0 : n) > 1 ? 1 : n);
      };

      e.ToDegree = function () {
        return 180 / Math.PI;
      };

      e.getSinValue = function (e) {
        return Math.sin(e * Math.PI / 180);
      };

      e.getCosValue = function (e) {
        return Math.cos(e * Math.PI / 180);
      };

      e.getSpeedY = function (e, t) {
        e = Math.abs(e);
        return 0 === t ? e : 90 === t ? 0 : 180 === t ? -e : 270 === t ? 0 : this.getCosValue(t) * e;
      };

      e.getSpeedX = function (e, t) {
        e = Math.abs(e);
        return 0 === t ? 0 : 90 === t ? e : 180 === t ? 0 : 270 === t ? -e : this.getSinValue(t) * e;
      };

      e.getAngleByVector = function (e) {
        if (0 === e.y) return e.x < 0 ? 270 : e.x > 0 ? 90 : 0;

        if (0 === e.x) {
          if (e.y >= 0) return 0;
          if (e.y < 0) return 180;
        }

        var t = Math.abs(e.y) / Math.abs(e.x),
            n = 0;
        e.y > 0 && e.x < 0 ? n = 270 + 180 * Math.atan(t) / Math.PI : e.y > 0 && e.x > 0 ? n = 90 - 180 * Math.atan(t) / Math.PI : e.y < 0 && e.x < 0 ? n = 270 - 180 * Math.atan(t) / Math.PI : e.y < 0 && e.x > 0 && (n = 90 + 180 * Math.atan(t) / Math.PI);
        return n;
      };

      e.getVectorByAngle = function (e) {
        if (0 == e) return cc.v2(0, 0);
        if (90 == e) return cc.v2(1, 0);
        if (180 == e) return cc.v2(0, -1);
        if (270 == e) return cc.v2(-1, 0);
        var t = this.getSpeedX(1, e),
            n = this.getSpeedY(1, e);
        return cc.v2(t, n);
      };

      Object.defineProperty(e, "getScreenAspectRatio", {
        get: function get() {
          return cc.winSize.height / cc.winSize.width;
        },
        enumerable: !1,
        configurable: !0
      });

      e.isGif = function (e) {
        return -1 != e.indexOf(".gif");
      };

      e.loadImage = function (e, t, n) {
        e.spriteFrame = null;
        cc.assetManager ? cc.assetManager.loadRemote(t, {
          ext: ".png"
        }, function (t, o) {
          if (null == t) {
            o && (o.packable = !1);
            var i = new cc.SpriteFrame(o);
            e.spriteFrame = i;
          } else console.log("loadRemote error", JSON.stringify(t));

          n && n(null == t);
        }) : cc.loader.load({
          url: "",
          type: ".png"
        }, function (t, o) {
          if (null == t) {
            o && (o.packable = !1);
            var i = new cc.SpriteFrame(o);
            e.spriteFrame = i;
          } else console.log("loadRemote error", JSON.stringify(t));

          n && n(null == t);
        });
      };

      e.ascallToUtf8 = function (e) {
        return (e = (e = e.replace(/(\\u)(\w{1,4})/gi, function (e) {
          return String.fromCharCode(parseInt(escape(e).replace(/(%5Cu)(\w{1,4})/g, "$2"), 16));
        })).replace(/(& #x)(\w{1,4});/gi, function (e) {
          return String.fromCharCode(parseInt(escape(e).replace(/(%26%23x)(\w{1,4})(%3B)/g, "$2"), 16));
        })).replace(/(& #)(\d{1,6});/gi, function (e) {
          return String.fromCharCode(parseInt(escape(e).replace(/(%26%23)(\d{1,6})(%3B)/g, "$2")));
        });
      };

      return e;
    }();

    e.Helper = n;
  })(c = t.Util || (t.Util = {}));

  var d = function () {
    function e() {}

    e.hasKey = function (e) {
      var t = cc.sys.localStorage.getItem(e);
      return null != t && "" != t;
    };

    e.getValue = function (t, n) {
      !e.hasKey(t) && n && e.setValue(t, n);
      return cc.sys.localStorage.getItem(t);
    };

    e.setValue = function (e, t) {
      cc.sys.localStorage.setItem(e, t);
    };

    e.deleteKey = function (e) {
      cc.sys.localStorage.removeItem(e);
    };

    e.clearAll = function () {
      cc.sys.localStorage.clear();
    };

    return e;
  }();

  t.LocalStorage = d;

  var h = function () {
    function e() {
      this.item = null;
      this.preItem = null;
      this.msgList = [];
    }

    Object.defineProperty(e, "Inst", {
      get: function get() {
        if (null == e._INST) {
          e._INST = new e();

          e._INST.load();
        }

        return e._INST;
      },
      enumerable: !1,
      configurable: !0
    });

    e.prototype.showToast = function (e) {
      var t = this;

      if (null != e) {
        console.log("提示：" + e);
        this.msgList.push(e);
      }

      if (this.item && (!this.preItem || !cc.isValid(this.preItem, !0))) {
        var n = this.msgList[0];
        this.msgList.splice(0, 1);
        var o = cc.instantiate(this.item);
        this.preItem = o;
        o.getChildByName("Item").getChildByName("Label").getComponent(cc.Label).string = n;
        cc.director.getScene().getChildByName("Canvas").addChild(o);
        if (cc.director.isPaused()) setTimeout(function () {
          if (o && o.isValid) {
            o.destroy();
            t.msgList.length > 0 && setTimeout(function () {
              t.showToast(null);
            }, 300);
          }
        }, 3e3);else {
          o.opacity = 0;
          var i = cc.fadeIn(.3),
              a = cc.delayTime(2.5),
              r = cc.fadeOut(.3),
              s = cc.callFunc(function () {
            if (o && o.isValid) {
              o.destroy();
              t.msgList.length > 0 && t.showToast(null);
            }
          });
          o.runAction(cc.sequence(i, a, r, s));
        }
      }
    };

    e.prototype.load = function () {
      if (!this.item) {
        var e = this;
        cc.resources.load("SDK/Toast", function (t, n) {
          if (null == t) {
            e.item = n;
            e.msgList.length > 0 && e.showToast(null);
          } else console.log("err", t);
        });
      }
    };

    return e;
  }();

  t.ToastMgr = h;

  (function () {
    var e;

    (function () {
      var e = function e() {
        var e = n.Channel.view;
        window.qg ? cc.sys.platform === cc.sys.OPPO_GAME ? e = n.Channel.oppo : cc.sys.platform === cc.sys.VIVO_GAME ? e = n.Channel.vivo : cc.sys.platform === cc.sys.HUAWEI_GAME ? e = n.Channel.huawei : cc.sys.platform === cc.sys.XIAOMI_GAME && (e = n.Channel.xm) : window.tt ? e = n.Channel.tt : window.gamebox ? e = n.Channel.box4399 : window.qq ? e = n.Channel.qq : window.wx ? e = n.Channel.wx : cc.sys.isNative && (cc.sys.os === cc.sys.OS_ANDROID ? e = n.Channel.android : cc.sys.os === cc.sys.OS_IOS && (e = n.Channel.ios));
        return e;
      };

      console.log("Loader");
      e() == n.Channel.android || e() == n.Channel.ios ? setTimeout(function () {
        l.Inst.setup(e());
      }, 100) : l.Inst.setup(e());
    })(e || (e = {}));
  })(t.Loader || (t.Loader = {}));
})(n || (n = {}));

window.SDK = n;

cc._RF.pop();